이중우선순위큐
-
이중우선순위큐프로그래머스 2022. 11. 30. 12:17
class Solution { fun solution(operations: Array): IntArray { var answer = intArrayOf() var tempList = mutableListOf() operations.forEach{ if(it.split(" ")[0] == "I"){ tempList.add(it.split(" ")[1].toInt()) } else if(it.split(" ")[0] == "D" && it.split(" ")[1] == "1" && tempList.isNotEmpty()){ tempList.remove(tempList.maxOrNull()) } else if(it.split(" ")[0] == "D" && it.split(" ")[1] == "-1" && t..