Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2731. Movement of Robots
Robots move 1 unit/sec left or right and instantly swap directions on collision; compute the sum of pairwise distances after d seconds modulo 1e9+7. Using the observation that collisions only swap identities (so final positions are nums[i] ± d), the task reduces to efficiently computing the sum of absolute differences among those final coordinates (e.g., via sorting and prefix sums).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.