Agree, it's not a travelling salesman problem, so a description framing it as something like a budget problem rather than distances would have made this much more understandable. I found getting to the solution itself took less time than understanding what the problem wanted me to do!
This is not how distances work. Description would make more sense if it was something fixed - either roundtrip distances on each day or if there's a budget and amounts are prices.
Agree, it's not a travelling salesman problem, so a description framing it as something like a budget problem rather than distances would have made this much more understandable. I found getting to the solution itself took less time than understanding what the problem wanted me to do!
Agree this function is incorrect, and it's unfortunate that it was upvoted so many times.
Temporary arrays - against the rules
This is not how distances work. Description would make more sense if it was something fixed - either roundtrip distances on each day or if there's a budget and amounts are prices.