Easy and simple explanation in python 🚀🚀
IntuitionWe repeatedly replace each pair of adjacent digits with their sum modulo 10. This reduces the length of the string step by step until only two digits r
# Intuition
We repeatedly replace each pair of adjacent digits with their sum modulo 10. This reduces the length of the string step by step until only two digits remain. If the final two digits are the same, we return `True`; otherwise, we return `False`.

# Approach
1. Convert the given string `s` into a new string where each digit is the sum of two adjacent digits modulo 10.
2. Repeat this process until only two digits remain in `s`.
3. Check if the two remaining digits are the same.
4. Return `True` if they are the same, otherwise return `False`.

# Complexity
- Time complexity:  
  Since we need to traverse entirety of the string and also traverse it each time to reduce its length. Time complexity is $$O(n^2)$$
  
- Space complexity:  
  We create a new string in each step, but the total space used is proportional to the input size, so it is $$O(n)$$.

# Code
```python []
class Solution:
    def hasSameDigits(self, s: str) -> bool:

        while len(s) > 2:
            newS = []
            for i in range(len(s) - 1):
                newS.append(str((int(s[i]) + int(s[i + 1])) % 10))

            s = "".join(newS)

        return s[0] == s[1]

['Math', 'String', 'String Matching', 'Python3']