Boustrophedon Seat
Medium · rating 1350 · Matrix, Simulation
An r × c seating grid is numbered 1, 2, 3, … row by row, but every other row runs right-to-left (row 0 left-to-right, row 1 right-to-left, and so on). The first line has r and c. The second line has a 0-based row and col. Print the seat number at that position.
Constraints: 1 ≤ r, c ≤ 104
Related problems
- Matrix Diagonal Sum — Medium
- Heaviest Row — Medium
- Rating Simulation — Medium
- Rotate Matrix 90° — Medium
- Tournament Champion — Medium
- Spiral Order — Medium