注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
上午做完OA,现在来贡献给地里,希望能帮到大家!
Code Question 1 (Leetcode 973) --
Given a list of N possible delivery destinations, implement an algorithm to create the delivery plan for the closest X destinations.
Input:
The input to the function/method consists of two arguments:
allLocations, a list where each element consists of a pair of integers representing the x and y coordinates of the delivery locations;
numDeliveries, an integer representing the number of deliveries that will be delivered in the plan(X).
Output:
Return a list of elements where each element of the list represents the X closest x and y integer coordinates tegers.
Write an algorithm to determine the minimum distance required for the truck to deliver the order.
Output:
Return an integer representing the total distance traversed to deliver the order else return -1.
Constraints:
1 <= rows, columns <= 10^3
Example:
area = [[1, 0, 0],[1, 0, 0],[1, 9, 1]]
Output:
3 |