2545. Sort the Students by Their Kth Score
Read the full problem statement on LeetCode.
Difficulty: medium Acceptance: 86% Topics: Array, Sorting, Matrix
View full problem on LeetCode Reading material
Reference solution (spoiler · python)
# Time: O(mlogm)
# Space: O(1)
# sort
class Solution(object):
def sortTheStudents(self, score, k):
"""
:type score: List[List[int]]
:type k: int
:rtype: List[List[int]]
"""
score.sort(key=lambda x: x[k], reverse=True)
return score
Solution from kamyu104/LeetCode-Solutions · MIT
Similar questions