Staircase Problem

As taught by Prateek Sir, If we apply o(n) time complexity approach. Then what will be the terminating condition?

it should be
i (current row) >= number of rows or
j (current column ) < 0