All prompts are owned by LeetCode. To view the prompt, click the title link above.
Completed during Weekly Contest 400 (q1)
First completed : July 07, 2024
Last updated : July 07, 2024
Related Topics : String, Simulation
Acceptance Rate : 80.76 %
# https://leetcode.com/problems/minimum-number-of-chairs-in-a-waiting-room/description/
# Did during Weekly Contest 400
class Solution:
def minimumChairs(self, s: str) -> int:
maxx = 0
curr = 0
for i in s :
if i == 'L' :
curr = max(0, curr - 1)
else :
curr += 1
maxx = max(curr, maxx)
return maxx