[LeetCode] #23. Merge k Sorted Lists (python)
문제 https://leetcode.com/problems/merge-k-sorted-lists/ Merge k Sorted Lists - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com k개의 정렬된 연결리스트들을 오름차순으로 정렬된 하나의 연결리스트로 합쳐야한다. 예시 입출력 Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] 풀이 책 풀이 우선순위 큐를 이용한 리스트 병합 import heapq..
2022. 3. 9.
[LeetCode] #232. Implement Queue using Stacks (python)
문제 https://leetcode.com/problems/implement-queue-using-stacks/ Implement Queue using Stacks - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 스택을 사용해서 큐를 구현하는 문제다. 예시 입출력 Input ["MyQueue", "push", "push", "peek", "pop", "empty"] [[], [1], [2], [], [], []] Output [null, null, null, ..
2022. 2. 24.