My 88th Problem
ApproachWe iteratively reduce the input string s by replacing it with a new string where each character is the sum modulo 10 of every pair of consecutive digits
# Approach
We iteratively reduce the input string `s` by replacing it with a new string where each character is the sum modulo 10 of every pair of consecutive digits in `s`.
This is repeated until only two digits remain.
We then return True if the final two digits are the same, otherwise False.

# Complexity
- Time complexity:
  $$O(n^2)$$  
  At each step, the string size decreases by 1 (from n to n-1 to n-2...), so the total number of operations is:
  $$(n-1) + (n-2) + \dots + 1 = O(n^2)$$

- Space complexity:
  $$O(n)$$  
  We create a new string in each iteration of length (len(s) - 1), which in total is bounded by O(n) space.

# Code
```python []
class Solution(object):
    def hasSameDigits(self, s):
        while len(s) > 2:
            new_s = ""
            for i in range(len(s) - 1):
                summed = (int(s[i]) + int(s[i + 1])) % 10
                new_s += str(summed)
            s = new_s
        return s[0] == s[1]
        """
        :type s: str
        :rtype: bool
        """
        
```
['Math', 'String', 'Simulation', 'Combinatorics', 'Number Theory', 'Python']