Consecutive Flat Allotment
Consecutive Flat Allotment
HardArrays0% accepted
The housing society in Delhi allocates flats to families. Some flats are available (0), others sold or reserved (1). Priya needs to find the longest sequence of consecutive available flats for an extended family.
Approach
Given an array where 0 represents available flats and 1 represents sold/reserved flats, find the longest subarray of consecutive zeros.
Input
flats=[1,0,0,0,1,0,0,1,0,0,0,0]
Output
4
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