2545. Sort the Students by Their Kth Score
2023. 1. 29. 00:00ㆍAlgorithm/Leetcode, Lintcode, HackerRank, etc.
- 목차
반응형
Python
class Solution:
def sortTheStudents(self, score: List[List[int]], k: int) -> List[List[int]]:
return sorted(score, key=lambda p: p[k], reverse=True)
Kotlin
class Solution {
fun sortTheStudents(score: Array<IntArray>, k: Int): Array<IntArray> {
val res = score.sortedByDescending { it[k] }
return res.toTypedArray()
}
}
반응형
'Algorithm > Leetcode, Lintcode, HackerRank, etc.' 카테고리의 다른 글
2717. Semi-Ordered Permutation (0) | 2023.06.05 |
---|---|
2541. Minimum Operations to Make Array Equal II (0) | 2023.01.29 |
2544. Alternating Digit Sum (0) | 2023.01.28 |
2255. Count Prefixes of a Given String (0) | 2023.01.26 |
2269. Find the K-Beauty of a Number (0) | 2023.01.26 |