Function to find all possible paths to reach end of array requiring minimum number of steps
def possiblePath ( arr , dp ) : NEW_LINE INDENT queue = Queue ( maxsize = 0 ) NEW_LINE p1 = Pair ( 0 , "0" , dp [ 0 ] ) NEW_LINE queue . put ( p1 ) NEW_LINE while queue . qsize ( ) > 0 : NEW_LINE INDENT tmp = queue . get ( ) NEW_LINE if tmp . jmps == 0 : NEW_LINE INDENT print ( tmp . psf ) NEW_LINE continue NEW_LINE DEDENT for step in range ( 1 , arr [ tmp . idx ] + 1 , 1 ) : NEW_LINE INDENT if ( ( tmp . idx + step < len ( arr ) ) and ( tmp . jmps - 1 == dp [ tmp . idx + step ] ) ) : NEW_LINE DEDENT DEDENT DEDENT