LeetCode solutions

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

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 7ms, memory 23.3MB, accepted 2025-12-31.

python
class Solution:
    def sortTheStudents(self, score: List[List[int]], k: int) -> List[List[int]]:
        return sorted(score, key=lambda x: x[k], reverse=True)

Source