Last active
September 7, 2020 15:47
-
-
Save bky373/9eadf403d90582424da657d59e238cf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution { | |
fun solution(array: IntArray, commands: Array<IntArray>) { | |
fun solution(array: IntArray, commands: Array<IntArray>): IntArray { | |
var answer: IntArray | |
answer = commands.map { | |
val i = it[0]-1 | |
val j = it[1] | |
val k = it[2]-1 | |
val subArr = array.toMutableList().subList(i, j).sortedBy { it } | |
subArr[k] | |
}.toIntArray() | |
return answer | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment