Lucky Numbers in a Matrix
All numbers in matrix are different. A number is lucky if it is the smallest in its row and also the largest in its column.
Return all lucky numbers, in increasing order.
Example 1
matrix [[3,7,8],[9,11,13],[15,16,17]]
returns [15]
15 is the smallest in its row and the largest in its column.
Example 2
matrix [[1,10,4,2],[9,3,8,7],[15,16,17,12]]
returns [12]
12 is the smallest in its row and the largest in its column.
Constraints
1 <= rows, cols <= 5- All numbers in the grid are different.
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.