A puzzle solver of a problem "where to move in" to stay in touch with friends.
You have 9 friends, who live in 9 houses within a one straight street. Lengths of particular houses counting from the left beginning of the street are like below:
- A — 1.1 km
- B — 2.3 km
- C — 3.0 km
- D — 4.2 km
- E — 5.1 km
- F — 6.3 km
- G — 13.4 km
- H — 19.1 km
- I — 27.5 km
On which particular kilometre on the street (counting from the left) you would hire a flat, to minimize the sum of the lengths to all your friends, who live on the same street? In other words: find the point X, for which function: dist(A,X) + dist(B,X) + … + dist(I,X) gives smallest value.