Practice Minimum Number of Chairs in a Waiting Room
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Given a sequence s of events in an initially empty waiting room, E means one person enters and needs a chair, while L means one person leaves and frees a chair. Process the events in order and return the minimum number of chairs needed so every entering person can sit.
Source: Minimum Number of Chairs in a Waiting Room on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "EEEEEEE"
Output
7
# Example 2
Input
s = "ELELEEL"
Output
2
# Example 3
Input
s = "ELEELEELLL"
Output
3
Constraints
1 <= s.length <= 50
s consists only of the letters 'E' and 'L'.
s represents a valid sequence of entries and exits.
Related LeetCode Problems
Practice more problems similar to Minimum Number of Chairs in a Waiting Room.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.