LeetCode solutions

3426. Minimum Number of Chairs in a Waiting Room

My accepted Python solution to LeetCode problem 3426, Minimum Number of Chairs in a Waiting Room, running in 1ms.

  • Difficulty: Easy
  • Python
  • Runtime 1ms
  • Memory 17.5MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 1ms, memory 17.5MB, accepted 2025-12-29.

python
class Solution:
    def minimumChairs(self, s: str) -> int:
        current = 0
        max_chairs = 0
        for c in s:
            if c == 'E':
                current += 1
                max_chairs = max(max_chairs, current)
            else:
                current -= 1
        return max_chairs

Source