Search
⌘K

Leetcode 2463. Minimum Total Distance Traveled

Assign each robot to a factory on the number line (each factory has a repair capacity) so every robot moves left or right to a factory and the total sum of absolute travel distances is minimized. Because crossings don't matter and positions are unique, the core challenge is optimally matching sorted robots to capacitated factories — typically solved with prefix-based dynamic programming.

Asked at:

Amazon

Amazon

Google

Google


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid December, 2024

Google

Google

Mid-level

Transport packages from N packing facilities to warehouse W on an M x N grid. Find minimum distance to transport all packages given warehouse location, packing facility locations, and initial position.

Late September, 2024

Amazon

Amazon

Senior

Calculate total distance traveled by trucks to refuel given truck positions and additional gas station queries

Comments

Your account is free and you can post anonymously if you choose.