I'm making the following assumptions, but I think I have a solution:
Town X1 is 1 mile from X0, X2 is 2 miles from X0, etc... (otherwise I don't believe there is enough information to come up with a solution)
friendTownList uses format C (flattened list)
the return trip from the last friend's house back to X0 is included in the total
Could be one (ugly) line if not counting error handling in the case where we don't know where a friend lives, could also be smaller if friendTownList was a hash to start with~
I'm making the following assumptions, but I think I have a solution:
friendTownList
uses format C (flattened list)Could be one (ugly) line if not counting error handling in the case where we don't know where a friend lives, could also be smaller if
friendTownList
was a hash to start with~I'll update / post another solution if the question is updated with more information!
Wow! Love that we are all over here just complaining about not having enough data and you just went for it!
Love it! Keep up the awesome work on these challenges!