Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Track the formation of contiguous house segments on a number line as positions are added sequentially.
After each insertion, determine and record the length of the longest currently formed block.
Input guarantees prevent simultaneous bridging of two separate segments in a single step.
What This Tests
Dynamic interval state management
Efficient lookup and update strategies using hash maps
Boundary endpoint tracking optimization
Sequential processing with running aggregates
Common Patterns
Hashing
Union Find
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected