Practice Sort the Students by Their Kth Score
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
There is a class with m students and n exams. You are given a 0-indexed m x n integer matrix score, where each row represents one student and score[i][j] denotes the score the ith student got in the jth exam. The matrix score contains distinct integers only. You are also given an integer k. Sort the students (i.e., the rows of the matrix) by their scores in the kth (0-indexed) exam from the highest to the lowest. Return the matrix after sorting it.
Source: Sort the Students by Their Kth Score on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
score = [[10,6,9,1],[7,5,11,2],[4,8,3,15]], k = 2
[[7,5,11,2],[10,6,9,1],[4,8,3,15]]
# Example 2
score = [[3,4],[5,6]], k = 0
[[5,6],[3,4]]
Constraints
Related LeetCode Problems
Practice more problems similar to Sort the Students by Their Kth Score.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.