Skip to content

Commit 275216c

Browse files
committed
Runtime 58 ms (Top 99.1%) | Memory 27.0 MB (Top 26.21%)
1 parent 1ceba69 commit 275216c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
class Solution {
3+
public:
4+
// int x;
5+
// bool static cmp(vector<int> &a,vector<int> &b){
6+
// return a[x]>b[x];
7+
// }
8+
vector<vector<int>> sortTheStudents(vector<vector<int>>& score, int k) {
9+
vector<vector<int>> v;
10+
for(int i = 0; i < score.size(); i++){
11+
v.push_back({score[i][k],i});
12+
}
13+
sort(v.begin(),v.end());
14+
vector<vector<int>> ans;
15+
for(int i = score.size()-1; i>=0; i--){
16+
ans.push_back(score[v[i][1]]);
17+
}
18+
return ans;
19+
}
20+
};

0 commit comments

Comments
 (0)