Alice is going to be late for school. As the map shows, a normal student would have to go through 6 paths to get there. Fortunately, Alice has a superpower to teleport to any nodes with the same color as her current node. She can use this power only once .
What is the least number of paths she needs to go through to get to school?
Clarification: The teleportation happens instantaneously and thus is not included in the count.
Harry is also late for school but he has better superpowers!
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The main thing to note is that you're allowed to teleport only once.
If you teleport from the first red to the other, then you can best make 4 moves to reach school
if you move from red to green and then teleport , you make 6 moves, not desirable at all
we can similarly count the number of moves required for each type but the least number of moves is when we move from red to green to red to blue and then teleport to school - taking only 3 moves which is most desirable