2631. Sort the Students by Their Kth Score
My accepted Python solution to LeetCode problem 2631, Sort the Students by Their Kth Score, running in 7ms.
- Difficulty: Medium
- Python
- Runtime 7ms
- Memory 23.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 7ms, memory 23.3MB, accepted 2025-12-31.
class Solution:
def sortTheStudents(self, score: List[List[int]], k: int) -> List[List[int]]:
return sorted(score, key=lambda x: x[k], reverse=True)