Skip to content

Commit 30c8be2

Browse files
authored
Create sort-the-students-by-their-kth-score.cpp
1 parent a670368 commit 30c8be2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Time: O(mlogm)
2+
// Space: O(1)
3+
4+
// sort
5+
class Solution {
6+
public:
7+
vector<vector<int>> sortTheStudents(vector<vector<int>>& score, int k) {
8+
sort(begin(score), end(score), [&](const auto& a, const auto& b) {
9+
return a[k] > b[k];
10+
});
11+
return score;
12+
}
13+
};

0 commit comments

Comments
 (0)