rowCount
and colCount
arrays to store the count of ones in each row and column respectively.rowCount
and colCount
with the appropriate counts.specialCount
to keep track of the number of special positions found.(i, j)
with a value of 1, check if rowCount[i]
and colCount[j]
are both equal to 1.specialCount
as we have found a special position.specialCount
.