- #1
Panphobia
- 435
- 13
http://dwite.ca/questions/haunted_house.html
So this is from a contest I wrote a while back, I took the greedy approach for my solution, and I did get 5/5, but my solution was not totally correct because the shortest path was not guaranteed, if a candy was 2 spaces before the start, and a candy was 1 space in front, my algorithm would go to the candy 1 space in front, then to the one 2 spaces back, and then carry on. But to finish this algorithm correctly you would need to figure out all permutations of paths through the candies. So how would I even start to do that? It has been bugging me for a while now.
So this is from a contest I wrote a while back, I took the greedy approach for my solution, and I did get 5/5, but my solution was not totally correct because the shortest path was not guaranteed, if a candy was 2 spaces before the start, and a candy was 1 space in front, my algorithm would go to the candy 1 space in front, then to the one 2 spaces back, and then carry on. But to finish this algorithm correctly you would need to figure out all permutations of paths through the candies. So how would I even start to do that? It has been bugging me for a while now.
Last edited by a moderator: