1380. Lucky Numbers in a Matrix Easy

@problem@discussion
#Array#Matrix



1/**
2 * [1380] Lucky Numbers in a Matrix
3 *
4 * Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order.
5 * A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column.
6 *  
7 * Example 1:
8 * 
9 * Input: matrix = [[3,7,8],[9,11,13],[15,16,17]]
10 * Output: [15]
11 * Explanation: 15 is the only lucky number since it is the minimum in its row and the maximum in its column.
12 * 
13 * Example 2:
14 * 
15 * Input: matrix = [[1,10,4,2],[9,3,8,7],[15,16,17,12]]
16 * Output: [12]
17 * Explanation: 12 is the only lucky number since it is the minimum in its row and the maximum in its column.
18 * 
19 * Example 3:
20 * 
21 * Input: matrix = [[7,8],[1,2]]
22 * Output: [7]
23 * Explanation: 7 is the only lucky number since it is the minimum in its row and the maximum in its column.
24 * 
25 *  
26 * Constraints:
27 * 
28 * 	m == mat.length
29 * 	n == mat[i].length
30 * 	1 <= n, m <= 50
31 * 	1 <= matrix[i][j] <= 10^5.
32 * 	All elements in the matrix are distinct.
33 * 
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/lucky-numbers-in-a-matrix/
38// discuss: https://leetcode.com/problems/lucky-numbers-in-a-matrix/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43    pub fn lucky_numbers (matrix: Vec<Vec<i32>>) -> Vec<i32> {
44        vec![]
45    }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52    use super::*;
53
54    #[test]
55    fn test_1380() {
56    }
57}
58


Back
© 2025 bowen.ge All Rights Reserved.