PLEASE HELP

Can we solve this problem in O(n) .

I was also studying the same from geeks where i thought the same approach i used for this month’s long challenge( see this)
taking every position as a node of a graph and the possible positions where we can jump in array representing edges of that graph, we just need to find the minimum distance from 0th node to the (n-1)th node which can be easily distance using BFS or dijkstra’s…

This may work, but probably yes i suppose. Please correct me if I am wrong…!!

1 Like

Because the complexity of BFS in adjacency list representation is O(V+E), i suppose its much better for small sized arrays.

thanks for your approach .

//