Find Best Theater Seat Window Availability
Find Best Theater Seat Window Availability
EasyArrays0% accepted
Meera wants to book group movie tickets at PVR Mumbai. Given array of theater seat statuses (0 = available, 1 = booked) and group size K, find minimum window length with at least K available seats.
Approach
Find minimum subarray length containing at least K zeros, or -1 if impossible.
Input
8
0 1 0 0 1 0 0] K=2
Output
2
More Arrays problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards