일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- concurrency
- 시바견
- attribute
- 315. Count of Smaller Numbers After Self
- 컴퓨터의 구조
- 밴픽
- 운영체제
- Decorator
- 프로그래머스
- Regular Expression
- 109. Convert Sorted List to Binary Search Tree
- Protocol
- Generator
- 715. Range Module
- DWG
- 43. Multiply Strings
- iterator
- Class
- data science
- kaggle
- t1
- Convert Sorted List to Binary Search Tree
- LeetCode
- shiba
- Python Code
- 파이썬
- 30. Substring with Concatenation of All Words
- Substring with Concatenation of All Words
- Python Implementation
- Python
Archives
- Today
- Total
목록772. Basic Calculator III (1)
Scribbling
LeetCode: 772. Basic Calculator III
class Solution: def calculate(self, s: str) -> int: # ' ' is intentionally added, # to mark the end of the given string s # encountering ' ' will add the last number to the stack self.s = s + ' ' self.ptr = 0 return self.calc() def calc(self): num, stack, sign = 0, [], '+' while self.ptr < len(self.s): c = self.s[self.ptr] # if met with '(', # get the evaluated number by recursion if c == '(': s..
Computer Science/Coding Test
2022. 3. 11. 16:30