|
3 | 3 | importjava.util.ArrayList; |
4 | 4 | importjava.util.List; |
5 | 5 |
|
6 | | -/** |
7 | | - * 1380. Lucky Numbers in a Matrix |
8 | | - * |
9 | | - * Given a m * n matrix of distinct numbers, return all lucky numbers in the matrix in any order. |
10 | | - * A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column. |
11 | | - * |
12 | | - * Example 1: |
13 | | - * Input: matrix = [[3,7,8],[9,11,13],[15,16,17]] |
14 | | - * Output: [15] |
15 | | - * Explanation: 15 is the only lucky number since it is the minimum in its row and the maximum in its column |
16 | | - * |
17 | | - * Example 2: |
18 | | - * Input: matrix = [[1,10,4,2],[9,3,8,7],[15,16,17,12]] |
19 | | - * Output: [12] |
20 | | - * Explanation: 12 is the only lucky number since it is the minimum in its row and the maximum in its column. |
21 | | - * |
22 | | - * Example 3: |
23 | | - * Input: matrix = [[7,8],[1,2]] |
24 | | - * Output: [7] |
25 | | - * |
26 | | - * Constraints: |
27 | | - * m == mat.length |
28 | | - * n == mat[i].length |
29 | | - * 1 <= n, m <= 50 |
30 | | - * 1 <= matrix[i][j] <= 10^5. |
31 | | - * All elements in the matrix are distinct. |
32 | | - * */ |
33 | 6 | publicclass_1380 { |
34 | 7 | publicstaticclassSolution1 { |
35 | 8 | publicList<Integer>luckyNumbers(int[][]matrix) { |
|