unsorted
containing indices of all rows except the last one, since we compare each row with the next one.res
to 0, which will hold the count of columns to delete.j
.i
in unsorted
such that strs[i][j] > strs[i+1][j]
.res
as we need to delete this column.unsorted
by removing indices where strs[i][j] < strs[i+1][j]
as these rows are sorted with respect to the current column.res
as the minimum number of columns to delete.