Practice Minimum Total Distance Traveled
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
robot gives distinct robot positions and factory contains [position,limit] for distinct factory locations. Choose when to start each robot and its initial left or right direction; it then travels at the common speed until the first factory with spare capacity repairs it. Full factories are passed, and robots cross without collision. Return the minimum total distance to repair every robot; sufficient capacity and a valid schedule are guaranteed.
Source: Minimum Total Distance Traveled on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
robot = [0,4,6], factory = [[2,2],[6,2]]
4
# Example 2
robot = [1,-1], factory = [[-2,1],[2,1]]
2
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Total Distance Traveled.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.