Algorithm/DS Problem#9: Assign Golf balls to holes

Solution

Main idea is to minimize the total time it takes for all golf balls to reach holes. The answer depends on the maximum distance that any golf ball has to travel and we have to minimize that distance as much as possible. That’s the greedy strategy is to put every ball to the nearest hole as much as possible.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
svalak

svalak

Passionate about learning ; Will write about #systemdesign #DSA #algorithms #linuxinternals #technology; Painting/Poem writing are my hobbies; Voracious Reader