Python Elegant & Short | Simulation
Complexity
Time complexity: O(n2)
Space complexity: O(n)
Code
# Complexity
- Time complexity: $$O(n^2)$$
- Space complexity: $$O(n)$$

# Code
```python3 []
class Solution:
    def hasSameDigits(self, s: str) -> bool:
        digits = [int(d) for d in s]

        while len(digits) > 2:
            digits = [(a + b) % 10 for a, b in pairwise(digits)]

        one, two = digits
        return one == two
```
['String', 'Simulation', 'Python', 'Python3']