Best Solution 👌👇
Complexity
Time complexity:O(n^2)

Space complexity:O(n)
Code
# Complexity
- Time complexity:O(n^2)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(n)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public boolean hasSameDigits(String s) {
        
        if (s.length() < 2) return true;

        while(s.length() > 2){
            String ans = "";
            for(int i=0;i<s.length()-1;i++){
                ans += String.valueOf((Integer.valueOf(s.charAt(i)) - '0' + Integer.valueOf(s.charAt(i + 1)) - '0') % 10);
            }
            s = ans ;
        }
        if (s.charAt(0) == s.charAt(1)) return true;
        else return false;
    }
}
```
['String', 'String Matching', 'Java']