Simple java solution- O(log(n))
Code
# Code
```java []
class Solution {
    public boolean hasSameDigits(String s) {
       while (s.length()>2) {
			String str = "";
			for (int i = 0; i < s.length() - 1; i++) {
				int num = Character.getNumericValue(s.charAt(i)) + Character.getNumericValue(s.charAt(i + 1));
				str += num%10;
			}
			s = str;
		}
		return s.charAt(0) == s.charAt(1);
    }
}
```
['Java']