We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 726e6d0 commit b45c732Copy full SHA for b45c732
scripts/algorithms/L/Lucky Numbers in a Matrix/Lucky Numbers in a Matrix.cpp
@@ -1,22 +1,23 @@
1
+// Runtime: 87 ms (Top 5.05%) | Memory: 15.9 MB (Top 5.33%)
2
class Solution {
3
public:
4
vector<int> luckyNumbers (vector<vector<int>>& matrix) {
-
5
+
6
unordered_map<int,vector<int>>m;
7
8
for(int i=0;i<matrix.size();i++){
9
vector<int>temp = matrix[i];
10
for(int j=0;j<temp.size();j++){
11
m[j].push_back(temp[j]);
12
}
13
14
15
unordered_map<int,int>mp;
16
17
vector<int>helper = matrix[i];
18
19
sort(helper.begin(),helper.end());
20
21
mp[helper[0]]++;
22
23
vector<int>result;
@@ -30,4 +31,4 @@ class Solution {
30
31
32
return result;
33
-};
34
+};
0 commit comments