← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Given a binary matrix binaryMatrix, find the leftmost column with at least one 1. If no such column exists, return -1.
Example 1:
plaintext Input: binaryMatrix = [ [0,0,0,1], [0,0,1,1], [1,1,0,1] ] Output: 1
The first column has an element 1 at row 2 and row 3.
Example 2:
plaintext Input: binaryMatrix = [ [0,0,0,0], [0,0,0,1], [0,0,1,1] ] Output: 1
The first column has an element 1 at row 2 and row 3.
Example 3:
plaintext Input: binaryMatrix = [ [0,0,0,0], [0,0,0,0], [0,0,0,0] ] Output: -1
There is no column which contains a 1.
m == binaryMatrix.lengthn == binaryMatrix[i].length1 <= m, n <= 100binaryMatrix[i][j] is either 0 or 1NOT_FOUND