Company: uber_6feb
Difficulty: medium
Uber Hierarchical Spatial Indexing body { font-family: sans-serif; } h1, h2 { color: #333; } code { background-color: #f4f4f4; padding: 2px 5px; border-radius: 3px; } pre { background-color: #f4f4f4; padding: 10px; border-radius: 5px; overflow-x: auto; } table { border-collapse: collapse; width: 50%; margin-top: 15px; } th, td { border: 1px solid #ddd; padding: 8px; text-align: left; } th { background-color: #f2f2f2; } Uber Hierarchical Spatial Indexing Problem Description Uber uses a Hierarchical Spatial Indexing system called HS to partition the world into hexagonal zones. These zones exist at different resolutions: smaller hexagons are contained within larger hexagons (similarly, zones are contained within even larger ones). You are given a map of these zones represented as a tree. The parents array defines the hierarchy, where parents[i] is the parent of zone i . The root zone is the entire world, indicated by parents[i] = -1 . Each zone has a unique ID equal to its index. The Uber