C# Linq
Intuition\nThe matrix is the same as before only if all its rows are the same as before.\n\nThe row with length n is the same as before only when all its elemen
# Intuition\nThe matrix is the same as before only if all its rows are the same as before.\n\nThe row with length `n` is the same as before only when all its elements with the index `i` are equal to the element with the index `(i + k) % n`. \n\n# Approach\nSimply traverse all elements in all rows;\n\n# Complexity\n\nSuppose the matrix is with the size `m * n`.\n\n- Time complexity:\n$$O(mn)$$\n\n# Code\n```\npublic class Solution {\n    public bool AreSimilar(int[][] mat, int k) => mat.All(row => Enumerable.Range(0, row.Length).All(i => row[(i + k) % row.Length] == row[i]));\n}\n```
['C#']