자료구조(20)
-
[LeetCode] Kth Largest Element in an Array (Python)
보호되어 있는 글입니다.
2024.03.12 -
[LeetCode] Sort Colors (Python)
보호되어 있는 글입니다.
2024.03.12 -
[LeetCode] Evaluate Reverse Polish Notation (Python)
import math class Solution: def evalRPN(self, tokens: List[str]) -> int: operation = ["+", "-", "*", "/"] stack = [] if len(tokens) == 1: return int(tokens[0]) for i in range(len(tokens)): if tokens[i] not in operation: stack.append(int(tokens[i])) else: num1 = stack.pop() num2 = stack.pop() new_num = 0 if tokens[i] == "+": new_num = num2 + num1 elif tokens[i] == "-": new_num = num2 - num1 elif ..
2024.03.06 -
[LeetCode] Min Stack (Python)
보호되어 있는 글입니다.
2024.03.06 -
[LeetCode] Design Circular Queue (Python)
보호되어 있는 글입니다.
2024.03.05 -
[LeetCode] Find All Numbers Disappeared in an Array (Python)
class Solution: def findDisappearedNumbers(self, nums: List[int]) -> List[int]: temp = set(range(1,len(nums)+1)) answer = temp - set(nums) return answer
2024.03.03