Beats 100% Easy Java Code to Understand Line to Line Explanation 
Code


# Code
```java []
class Solution {
    public boolean hasSameDigits(String s) {
        int n=s.length();
        int[] digit=new int[n];
        for(int i=0;i<n;i++){
            digit[i]=s.charAt(i)-'0'; //it get the Digit Value as charAt(i)-'0 = '3'-'0' = 51-48 = 3 
        }
        while(n>2){ //performs the operation until we get the 2 digit
            for(int i=0;i<n-1;i++){
                digit[i]=(digit[i]+digit[i+1])%10;//applying the given operation
            }
        n--;//reduce the array size 
        }
        return digit[0]==digit[1];//return true or false according to the condition
    }
}
```
['Math', 'String', 'String Matching', 'Number Theory', 'Java']