Given an m x n matrix of distinct numbers, return all lucky numbers in any order. A lucky number is an element that is the minimum of its row and the maximum of its column.
Input: A 2D array matrix of size m x n with distinct values.
Output: List of lucky numbers (can be empty).
Input: [[3,7,8],[9,11,13],[15,16,17]]
Output: [15]
Explanation: 15 is min of row 2 (min=15) and max of col 0 (max=15). Lucky!Input: [[1,10,4,2],[9,3,8,7],[15,16,17,12]]
Output: [12]
Explanation: 12 is min of row 2 (min=12) and max of col 3 (max=12).Input: [[7,8],[1,2]]
Output: [7]
Explanation: 7 is min of row 0 and max of col 0.m==matrix.lengthn==matrix[i].length1<=n,m<=501<=matrix[i][j]<=10^5All elements are distinct.