# breaking it down advanced

Meeting Point

Friends live along one street. Pick the meeting spot that minimizes everyone's TOTAL walking. 🏘️

You get the friends' house positions. The meeting spot can be any whole position from the smallest to the largest house. Try every candidate spot and print the smallest possible total walking distance.

Example:

Input: positions = [1, 5, 9] Output: 8

Trying every candidate spot from 1 to 9, meeting at 5 costs |1-5| + |5-5| + |9-5| = 4 + 0 + 4 = 8, the smallest total walking distance.

💡 need a hint?

brk-meeting-point.py🔒 given lines are locked — write your code in between
loading...