This one's pretty straightforward. If you have rows of length rowLength
, then the row is j / rowLength
(note that with integer arithmetic this automatically rounds down to the nearest integer) and the column is j % rowLength
.
Ben Aaronson
- 5.7k
- 21
- 39