목록lev4 (3)
취미가 좋다
https://leetcode.com/problems/sliding-window-maximum/submissions/ Sliding Window Maximum - 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 Solution import heapq from collections import defaultdict class Solution: def maxSlidingWindow(self, nums, k): ans = [max(nums[:k])] pq = [] ou..
https://www.acmicpc.net/problem/2636 2636번: 치즈 아래 과 같이 정사각형 칸들로 이루어진 사각형 모양의 판이 있고, 그 위에 얇은 치즈(회색으로 표시된 부분)가 놓여 있다. 판의 가장자리(에서 네모 칸에 X친 부분)에는 치즈가 놓 www.acmicpc.net Solution import sys input = sys.stdin.readline from collections import deque def melt(): num = 0 while(ready): i, j = ready.pop() cheese[i][j] = 0 num += 1 return num def chk(): while(q): i, j = q.pop() if cheese[i][j] == 1: ready.app..
https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Kth Smallest Element in a BST - 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 Solution class Solution: def kthSmallest(self, root, k): def rank(node, ans): if node.left and rank(node.left, ans): return True ans.append(n..