HackerRank CarWale Full-stack Developer Hiring Test 2021
the array shows the obstacle position in the lane. Find the minimum move for the game.
array = [2,1,2]
car always starts at position 2, and there are 3 lanes
so the obstacles are like
L1 L2 L3 | | * | | | * | | | | | * | | car
find the minimum number of lane change required.
Ex: 1, because car-->L3-->finish