Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.18 KB

_3168. Minimum Number of Chairs in a Waiting Room.md

File metadata and controls

45 lines (32 loc) · 1.18 KB

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Completed during Weekly Contest 400 (q1)

Back to top


First completed : July 07, 2024

Last updated : July 07, 2024


Related Topics : String, Simulation

Acceptance Rate : 80.62 %


Solutions

Python

# 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