Single traverse check (R-75%+, M-65%+)
Complexity
Time complexity: O(n * m)
n - length of the input matrix mat
m - height of the input matrix mat

Space complexity: O(1)
Code
# Complexity
- Time complexity: **O(n * m)**
**n** - length of the input matrix `mat`
**m** - height of the input matrix `mat`
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

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

# Code
```python3 []
class Solution:
    def areSimilar(self, mat: List[List[int]], k: int) -> bool:
        new_index: int
        shifts: int = k % len(mat[0])
        # Even rows -> to the left, 0 index == start from last index (or go negative)
        for even_row in range(0, len(mat), 2):
            for index in range(len(mat[even_row])):
                # We're python_bois == we can use negative indexing.
                # Or, we will just get a last index and take w.e left of shift there.
                # Like: len(mat[even_row] - 1) + (index - shifts) <- if it's negative.
                new_index = (index - shifts)
                if mat[even_row][index] != mat[even_row][new_index]:
                    return False
        # Odd rows -> to the right, limit == start from 0
        for odd_row in range(1, len(mat), 2):
            for index in range(len(mat[odd_row])):
                new_index = (index + shifts) % len(mat[odd_row])
                # W.e the place we shifted, we still need to check with original
                if mat[odd_row][index] != mat[odd_row][new_index]:
                    return False
        
        return True
```
['Array', 'Matrix', 'Simulation', 'Python3']