rowIncrements
and colIncrements
, to keep track of the increments for each row and column respectively.indices
and increment the corresponding entries in rowIncrements
and colIncrements
.oddCount
to 0 to keep track of the number of odd cells.oddCount
.oddCount
as the final result.