그냥 제곱하고 정렬쳐서 리턴
정답
class Solution {
fun sortedSquares(nums: IntArray): IntArray {
return nums.map { it * it }.sorted().toIntArray()
}
}
'알고리즘' 카테고리의 다른 글
릿코드 876. Middle of the Linked List 코틀린 (0) | 2024.03.07 |
---|---|
릿코드 141. Linked List Cycle 코틀린 (0) | 2024.03.06 |
릿코드 2864. Maximum Odd Binary Number 코틀린 (0) | 2024.03.01 |
릿코드 100. Same Tree 코틀린 (0) | 2024.02.26 |
릿코드 997. Find the Town Judge 코틀린 (0) | 2024.02.22 |