Share your repls and programming experiences

← Back to all posts
HackerRank CarWale Full-stack Developer Hiring Test 2021
ProbhakarSarkar (0)

the array shows the obstacle position in the lane. Find the minimum move for the game.

For example:
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