Function find_diagonal_order

Source
pub fn find_diagonal_order(matrix: Vec<Vec<i32>>) -> Vec<i32>
Expand description

When meet following conditions:

  1. up and j == n-1: i++
  2. up and i == 0: j++
  3. down and j == m-1: j++
  4. down and j == 0: i++ and let up = !up otherwise go up and right or go down and left.