Re: [algogeeks] Jumping Puzzle

2011-08-11 Thread Tharun Damera
Yes, greedy algo doesn't work.. U shud hv DP.. plz post the soln which u read.. A={2,2,3,4,1,1,1,1,1} Ur algo gives 0,2,5,6,7,8(these are indices... index starts frm 0) best soln is 0,1,3,7,8.. On Thu, Aug 11, 2011 at 2:37 PM, Arun Vishwanathan wrote: > I did not get the optimal solution part..h

Re: [algogeeks] Jumping Puzzle

2011-08-11 Thread Arun Vishwanathan
I did not get the optimal solution part..how is that u jump 1 to index 1? On Thu, Aug 11, 2011 at 10:07 AM, Algo Lover wrote: > Given an array, start from the first element and reach the last by > jumping. The jump length can be at most the value at the current > position in the array. Optimum r

[algogeeks] Jumping Puzzle

2011-08-11 Thread Algo Lover
Given an array, start from the first element and reach the last by jumping. The jump length can be at most the value at the current position in the array. Optimum result is when you reach the goal in minimum number of jumps. For ex: Given array A = {2,3,1,1,4} possible ways to reach the end (index