Skip to content

Instantly share code, notes, and snippets.

@bky373
Last active September 7, 2020 15:47
Show Gist options
  • Save bky373/9eadf403d90582424da657d59e238cf4 to your computer and use it in GitHub Desktop.
Save bky373/9eadf403d90582424da657d59e238cf4 to your computer and use it in GitHub Desktop.
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