Find Unoccluded Angular Sectors Around the Vehicle
Last updated: November 29, 2026
Quick Overview
Given a list of blocked angular intervals around a vehicle in degrees (intervals may wrap through 0), return the free sectors that are at least a minimum width wide. Each interval is given counterclockwise as (start, end).
Nuro
November 29, 20260
0
0 solved
Given a list of blocked angular intervals around a vehicle in degrees (intervals may wrap through 0), return the free sectors that are at least a minimum width wide. Each interval is given counterclockwise as (start, end).
Perception and planning engineers reason about which directions around the vehicle are visible or blocked, for example to decide whether a parked truck hides a crosswalk. This is an interval-merging question with a circular twist, and the interviewer watches for the wraparound case and the full-circle case.
What the Interviewer Expects
- Normalize angles and split wrapping intervals at 0/360
- Sort and merge overlapping or touching intervals
- Compute gaps between merged blocks including the gap that crosses 0
- Handle fully blocked and fully free inputs explicitly
- State O(n log n) complexity
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you return the single widest free sector efficiently if blocks arrive in a stream?
- How would you extend this to range-aware occlusion, where a block only hides things beyond a distance?
- How should floating point precision near 360 be handled?
- How would you represent this for a 3D lidar with elevation?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Blocked intervals (start, end) are counterclockwise in degrees, so (350, 10) covers 20 degrees through 0. Return free sectors (start, end) in the same convention with width at least min_width....
High-Level Design
Unroll the circle onto [0, 360]. A wrapping interval becomes two pieces, (s, 360) and (0, e). Sort and merge as with ordinary intervals. Free space is every gap between consecutive merged blocks...