In this tutorial, I have explained how to solve Leftmost Column with at Least a One LeetCode problem in O(n+m) time complexity and without using extra space.
LeetCode May Challenge PlayList - https://www.youtube.com/watch?v=Usm-QCwTQcg&list=PLUg9hRlm7gxSX8aXepxe54oslSpMvmyh4
LeetCode 30 Day Challenge PlayList - https://www.youtube.com/watch?v=-I1pUv57WG8&list=PLUg9hRlm7gxT8mrwa_648iC8Ah42E0W1o
Given a binary matrix (only 0s and 1s), Each row of a matrix is sorted in ascending order. We have to write a code to return leftmost column index with at least 1 in it. If such index doesn't exist return -1.
You can't access the Binary Matrix directly. You may only access the matrix using a BinaryMatrix interface:
i) BinaryMatrix.get(x, y) returns the element of the matrix at index (x, y).
ii) BinaryMatrix.dimensions() returns a list of 2 elements [n, m], which means the matrix is n * m.
NOTE:
You cannot call this method BinaryMatrix.get more than 1000 times.
This problem is the day 21 challenge of LeetCode 30 day challenge.
Website - https://webrewrite.com/
Paypal - https://www.paypal.me/programmingtutorials