How can I search for a value in a column-wise sorted array in linear time O(n)?
I need to write a function that takes in a column-wise sorted 2d array, and returns true if a specified value is in the array.
Example of a column-wise sorted array
int[][] m = {
{1, 2, 3},
{4, 6, 5},
{8, 10, 9}
};
How can I solve this problem in linear time O(n)?