This is a verified interview question from Uber. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Uber Green Zone Expansion" covers key patterns like Other.
"Uber plans to expand Green Zones (EV-only zones). You are given: road_nodes — number of zones road_from[i], road_to[i] — bidirectional roads road_weight[i] — travel distance partner[i] — partner managing zone i minGap — minimum shortest-path distance required between any two active Green Zones If Uber selects a partner, all zones managed by that partner become Green Zones. Constraint: No two active Green Zones may be within minGap distance (shortest path distance). Return the number of valid partner combinations. int countGreenZonePlans( int road_nodes, int[] road_from, int[] road_to, int[] road_weight, int minGap, int[] partner ) Example 1 road_nodes = 3 road_from = [1,2,3] road_to = [2,3,1] road_weight = [3,2,5] minGap = 4 partner = [1,2,3] Output: 4 Valid plans: {1} {2} {3} {1,3} Example 2 Input: road_nodes = 2 road_from = [1] road_to = [2] road_weight = [5] minGap = 4 partner = [1,2] Output: 3 Valid subsets: {} {1} {2} {1,2} (Note: exclude empty set if required by interpretation)"
Join thousands of developers practicing for Uber.