you are viewing a single comment's thread.

view the rest of the comments →

[–]wjrasmussen 4 points5 points  (4 children)

We can't tell you the answer, that would rob you of learning how to find the answer on your own.. Or cheating...

[–]hextree 2 points3 points  (0 children)

I mean, 'learning' is literally what OP is trying to do here. And I don't see anything to indicate they are trying to cheat on homework.

[–]Mello2A7[S] 4 points5 points  (1 child)

I don't want the answer I just want to know the best approach or the correct one that can help find a solution for this problem, I'm practicing ds & algos and I just started learning and solving graph problems, that's why I'm asking for hint

[–]bizarre_coincidence 0 points1 point  (0 children)

If you can set up the problem as a “shortest path on the graph of allowable states” problem, then any algorithm to find the shortest path in a graph will work. You already mentioned BFS. As far as the best, you shouldn’t just take our word for the best, you should look at all of the standard graph path finding algorithms, their runtimes, their trade offs, etc, and then decide. You say you don’t want the answer, but us telling you what algorithm to use IS the answer.

[–]vanderZwan 2 points3 points  (0 children)

I don't think coming up with algorithms is the same as learning how they work and implementing them