Amazon interview question

DP Programming problem regarding how to code robot to move along a certain pathway.