Search for a value in a matrix whose rows and columns are both sorted, then keep it sorted after replacing the value.
Search for a value in a matrix whose rows and columns are both sorted, then keep it sorted after replacing the value.
Opens with the full question.