Housing Society Floor Allocation
Housing Society Floor Allocation
MediumBinary Search100% accepted
Mumbai housing society allocates flats by seniority score. Floors have minimum score requirements: F1≥0, F2≥500, F3≥1000, F4≥1500. Find which floor Ravi gets with score 1200.
Approach
Given sorted floor score thresholds and resident score, find highest floor where resident_score ≥ threshold.
Input
thresholds=[0,500,1000,1500] score=1200
Output
2
More Binary Search 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