class Solution {
public int findNumbers(int[] nums) {
return checkEven(nums,0,0);
}
public int checkEven(int[] nums,int i,int ans){
if(i<nums.length){
int n=0;
while(nums[i]>0){
nums[i]/=10;
n++;
}
if(n%2==0){
ans++;
}
return checkEven(nums,i+1,ans);
}
return ans;
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter