Random commentary about C++, STL, Boost, Perl, Python, Algorithms, Problem Solving and Web Search
Monday, September 10, 2012
A frog jumping
A frog can jump a river of n meters and at each step she can jump either x-1 or x or x+1 meter if she jumped x meter at the previous step. She can jump just if the starting place and the ending place has a stone. The available stones are maintained in an array S[i] given as input. The first just is just 1 meter. Can you compute whether or not the frog will arrive at the destination?