Created
December 3, 2020 21:24
-
-
Save kingsamadesu/068e723aa0020febe6ea9c22dc4ddc44 to your computer and use it in GitHub Desktop.
1295. Find Numbers with Even Number of Digits -with java- (leetcode.com)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Your runtime beats 94.08 % of java submissions. | |
Your memory usage beats 67.73 % of java submissions. | |
*/ | |
class Solution { | |
public boolean test(int n){ | |
if(n==0){ | |
return true; | |
} | |
return false==test(n/10); | |
} | |
public int findNumbers(int[] nums) { | |
int sum = 0; | |
for(int i = 0 ; i < nums.length ; i++){ | |
if(test(nums[i])){ | |
sum++; | |
} | |
} | |
return sum; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment