Directi Interview QuestionSoftware Engineer / Developers
- 0of 0 votes
He gave me an array of Integers, each integer allows me to make at max its value jumps. If i am at zero, i'm stuck i cannot move forword. He asked me to find,
1). If the last index was reachable from the first index.
2). Minimum number of jumps required to reach the last index, given any index as the starting index.
3). Total number of ways one can reach the last index.
I was asked to write a code for this.
ex: 1 3 5 8 9 2 6 7 6 8 9
initially at one i can make only one jump to 3, from 3 i can jump either 1 step reaching 5, or 2 steps reaching 8, or 3 steps reaching 9. Carrying on in the same way till i can hit the last index.