Practice Cinema Seat Allocation
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
The cinema has n rows, numbered 1 through n, with seats 1 through 10 in each row. reservedSeats contains [row, seat] pairs that are unavailable. A four-person group may occupy seats 2–5, 4–7, or 6–9 within one row. Every seat in its block must be unreserved, and no seat may be assigned to more than one group. Return the maximum number of groups that can be seated.
Source: Cinema Seat Allocation on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 3, reservedSeats = [[1,2],[1,3],[1,8],[2,6],[3,1],[3,10]]
4
# Example 2
n = 2, reservedSeats = [[2,1],[1,8],[2,6]]
2
# Example 3
n = 4, reservedSeats = [[4,3],[1,4],[4,6],[1,7]]
4
Constraints
Related LeetCode Problems
Practice more problems similar to Cinema Seat Allocation.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.