Untitled
unknown
plain_text
2 years ago
579 B
9
Indexable
class Solution {
public int countSymmetricIntegers(int low, int high) {
int c=0;
for(int i=low;i<=high;i++){
String s=""+i;
if(s.length()%2==0){
int l=0;
int r=0;
for(int j=0;j<s.length()/2;j++){
r+=s.charAt(j)-'0';
}
for(int j=s.length()/2;j<s.length();j++){
l+=s.charAt(j)-'0';
}
if(l==r)
c++;
}
}
return c;
}
}Editor is loading...