Algorithm/Leetcode, Lintcode, HackerRank, etc.
2545. Sort the Students by Their Kth Score
Roiei
2023. 1. 29. 00:00
반응형
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()
}
}
반응형