feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,28 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def get_min_dist_sum(positions: list[list[int]]) -> float:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { positions: [[0, 1], [1, 0], [1, 2], [2, 1]] }
|
||||
expected: 4.00000
|
||||
- input: { positions: [[1, 1], [3, 3]] }
|
||||
expected: 2.82843
|
||||
hidden:
|
||||
- input: { positions: [[0, 0]] }
|
||||
expected: 0.00000
|
||||
- input: { positions: [[0, 0], [2, 0]] }
|
||||
expected: 2.00000
|
||||
- input: { positions: [[0, 0], [0, 1], [1, 0], [1, 1]] }
|
||||
expected: 2.82843
|
||||
- input: { positions: [[1, 1], [1, 1], [1, 1]] }
|
||||
expected: 0.00000
|
||||
- input: { positions: [[0, 0], [50, 50], [100, 100]] }
|
||||
expected: 141.42136
|
||||
- input: { positions: [[1, 2], [3, 4], [5, 6], [7, 8]] }
|
||||
expected: 11.31371
|
||||
|
||||
description: |
|
||||
A delivery company wants to build a new service center in a new city. The company knows the positions of all the customers in this city on a 2D-Map and wants to build the new center in a position such that **the sum of the Euclidean distances to all customers is minimum**.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user