Constant Diagonals Grid
A grid is *diagonal-constant* when every diagonal running from top-left to bottom-right contains a single repeated value.
Given a non-empty rectangular grid of integers, return true if it is diagonal-constant.
Example 1
Input: grid = [[1,2,3,4],[5,1,2,3],[9,5,1,2]] Output: true
Example 2
Input: grid = [[1,2],[2,2]] Output: false Explanation: The diagonal starting at (0, 0) holds 1 and 2.
Constraints
- 1 <= rows, cols <= 300
- 0 <= grid[r][c] <= 10^4
Hint 1
Each cell only needs to match the cell up and to the left of it.
Good practice for: Frontend Developer, Backend Developer, Full Stack Developer, Mobile App Developer, Automation Test Engineer, Game Developer
Run checks your code on 2 sample tests. Submit runs all 8 tests, including hidden ones, and earns points. Use console.log to debug. Python's first run can take a few seconds while it starts.