BookMyShow Theater Seating Optimization
BookMyShow Theater Seating Optimization
HardArrays0% accepted
Meera manages BookMyShow operations in Pune and needs to find the best seating arrangement for movie shows. Given a theater layout with blocked seats (renovations) and available seats, find the section with maximum contiguous available seats to accommodate large group bookings.
Approach
Given a 1D array representing theater seats in a row (0=available, -1=blocked, 1=booked), find the longest subarray of consecutive available seats.
Input
12
0 0 1 0 0 0 -1 0 0 1 0 0
Output
3
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