일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Tags
- 밴픽
- Python
- data science
- 시바견
- shiba
- 컴퓨터의 구조
- concurrency
- Convert Sorted List to Binary Search Tree
- Generator
- 30. Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- DWG
- 파이썬
- 프로그래머스
- kaggle
- Class
- attribute
- 운영체제
- t1
- LeetCode
- iterator
- Protocol
- 715. Range Module
- Regular Expression
- 109. Convert Sorted List to Binary Search Tree
- 43. Multiply Strings
- Python Implementation
- Python Code
- Substring with Concatenation of All Words
- Decorator
Archives
- Today
- Total
목록Evaluate Reverse Polish Notation (1)
Scribbling
LeetCode: 150. Evaluate Reverse Polish Notation
stack을 사용 class Solution: def evalRPN(self, tokens: List[str]) -> int: stack = [] predefined_tokens = ['+', '-', '*', '/'] operations = [lambda x, y : x + y, lambda x, y : x - y, lambda x, y : x * y, lambda x, y : int(x / y)] for token in tokens: if token in predefined_tokens: num2 = stack.pop() num1 = stack.pop() idx = predefined_tokens.index(token) stack.append(operations[idx](num1, num2)) els..
Computer Science/Coding Test
2021. 11. 26. 11:36