Spiral Matrix III: Visiting Grid Positions In Clockwise Spiral Order
Walk clockwise spiral through grid (rStart, cStart) visiting every position. Use direction array & step count to manage movement. Add positions to result if within grid boundaries.
885. Spiral Matrix III Medium Topics: Array, Matrix, Simulation You start at the cell (rStart, cStart) of an rows x cols grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column. You will walk in a clockwise spiral shape to visit every position in this grid. Whenever you move outside the grid's boundary, we continue our walk outside the grid (but may return to the grid boundary later.). Eventually, we reach all rows * cols spaces of the grid. Return an array of coordinates representing the positions of the grid in...
