Created
July 3, 2019 00:47
-
-
Save cg4jins/c8a54806131748020cda022807c4dbf0 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>): IntArray { | |
var answer = mutableListOf<Int>() | |
for (command in commands) { | |
var subList = array.toList() | |
.subList(command[0] - 1, command[1]) | |
subList = subList.sorted() | |
answer.add(subList[command[2] - 1]) | |
} | |
return answer.toIntArray() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment