일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 30. Substring with Concatenation of All Words
- kaggle
- Python
- 밴픽
- Regular Expression
- 시바견
- LeetCode
- 파이썬
- Python Code
- 프로그래머스
- 109. Convert Sorted List to Binary Search Tree
- 715. Range Module
- 컴퓨터의 구조
- 43. Multiply Strings
- t1
- concurrency
- shiba
- Protocol
- Generator
- 315. Count of Smaller Numbers After Self
- attribute
- DWG
- Convert Sorted List to Binary Search Tree
- Decorator
- data science
- Python Implementation
- 운영체제
- Substring with Concatenation of All Words
- Class
- iterator
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