Amity
Patrol — Optimal Route (NN Heuristic)
“Hug the coast, hit the nearest fin.” — Harbor Patrol
Challenge:
Order coordinates using a nearest-neighbor heuristic.
Operations • Routing
Task:
Implement
nearest_neighbor_route(points)
returning the visit order.
Start from the first point in the input. Repeatedly visit the closest unvisited point (Euclidean distance).
Click
Run Unit Tests
. If all tests pass, you'll get the flag.
def nearest_neighbor_route(points): # Your code here return points # Test runner do not edit below run_selected_test()
Run Unit Tests
Output or flag will appear here...