What does this mean???
i - 1 (Si-1) and i + 1 (Si+1)
Can somebody explain the 2nd test case
Input:
012134444444443
Output:
4
The jump sequence mentioned is 1-2-4-5-15.
I am not able to understand how we got this sequence…
Thanks
What does this mean???
i - 1 (Si-1) and i + 1 (Si+1)
Can somebody explain the 2nd test case
Input:
012134444444443
Output:
4
The jump sequence mentioned is 1-2-4-5-15.
I am not able to understand how we got this sequence…
Thanks
It means you can jump one index left(S1-1) or one index right(Si+1).
In this case chef jumps to 1 then to the second 1(index 4) then to 3(index 5) then as the last element is also 3, he can jump to the final index(15).
can any one tell me jump can be made reverse also…?
Eg:
0123456754360123457
Ans 5 correct or not.?