Skip to content

Commit 8143aa1

Browse files
authored
Create 3168. Minimum Number of Chairs in a Waiting Room.py
1 parent 589e559 commit 8143aa1

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
3+
'''
4+
1. 아이디어 :
5+
-
6+
7+
2. 시간복잡도 :
8+
O(n)
9+
10+
3. 자료구조/알고리즘 :
11+
-
12+
13+
'''
14+
class Solution:
15+
def minimumChairs(self, s: str) -> int:
16+
ans = 0
17+
curr = 0
18+
for char in s:
19+
if char == "E":
20+
curr += 1
21+
ans = max(ans, curr)
22+
else:
23+
curr -= 1
24+
return ans

0 commit comments

Comments
 (0)