Skip to content

Instantly share code, notes, and snippets.

@kingsamadesu
Created December 3, 2020 21:24
Show Gist options
  • Save kingsamadesu/068e723aa0020febe6ea9c22dc4ddc44 to your computer and use it in GitHub Desktop.
Save kingsamadesu/068e723aa0020febe6ea9c22dc4ddc44 to your computer and use it in GitHub Desktop.
1295. Find Numbers with Even Number of Digits -with java- (leetcode.com)
/*
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