Minimum Plate Collection Time
Updated
Problem statement
You are given n plates on a 2D plane. Plate i sits at point (x[i], y[i]).
Two plates are connected if they are in the same row or the same column and the distance between them is at most d. Connections chain together: if plate a is connected to plate b, and plate b is connected to plate c, then a, b and c are all in one group. When you collect any plate, every plate in its group is collected in that same second.
Each second, you may pick one plate that is not collected yet. Return the fewest seconds needed to collect all plates.
Function
getMinTime(n: int, d: int, x: int[], y: int[]) → intExamples
Example 1
n = 3d = 1x = [0, 2, 1]y = [0, 1, 2]return = 3No two plates are in the same row or column within distance 1. So each plate is its own group, and you need one second per plate: three seconds in total.
Constraints
1 <= n <= 10^50 <= d <= 10^90 <= x[i], y[i] <= 10^9
More Uber Online Assessment questions
- Count Palindromic Ancestor PathsOA · Seen Aug 2026
- Jump Game with Prime-3 StepsOA · Seen Aug 2026
- Last Truck to Leave the LaneOA · Seen Jul 2026
- Chain of CommandOA · Seen Jul 2026
- Total Palindrome Substring CostOA · Seen Jun 2026
- Jump Game with Prime-Step RuleOA · Seen May 2026
- Pipeline Throughput Maximization Under BudgetOA · Seen May 2026
- Balanced Prefix Sets in a PermutationOA · Seen Apr 2026
- Minimum Edge Reversals to Root a TreeOA · Seen Apr 2026
- Maximum Riders in CarOA · Seen Apr 2026