[Go] Array and string - Diagonal Traverse
My code func findDiagonalOrder(mat [][]int) []int { m, n := len(mat), len(mat[0]) result := make([]int, m*n) row, col, d := 0, 0, 1 for i := 0; i = m { row = m - 1 col += 2 d = -d } if col >= n { col = n - 1 row += 2 d = -d } if row < 0 { row = 0 d = -d } if col < 0 { col = 0 d = -d } } return result } This code is like walking pat..
Go/Leet Code
2022. 3. 27. 22:56