Skip to content

Commit 0b9e7b8

Browse files
authored
1331번 문제 solve (Kotlin)
1 parent 1143fc8 commit 0b9e7b8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* @author occidere
3+
* @Blog: https://blog.naver.com/occidere
4+
* @Github: https://github.com/occidere
5+
* @since 2023-01-01
6+
*/
7+
class Solution {
8+
fun arrayRankTransform(arr: IntArray): IntArray {
9+
val rankMap = arr.asSequence()
10+
.toSortedSet()
11+
.withIndex()
12+
.associate { (i, x) -> x to i + 1 }
13+
return arr.map { rankMap[it]!! }.toIntArray()
14+
}
15+
}

0 commit comments

Comments
 (0)