One linear - the shortest possible
IntuitionIt is easy to proof that it makes no difference whether we shifted left or right.Code
# Intuition
It is easy to proof that it makes no difference whether we shifted left or right.

# Code

```javascript []
const areSimilar = (mat, k, l = k % mat[0].length) => 
    mat.every(row => row.every((v, i) => v === row.at(i - l)));

```
['JavaScript']