Update greedy_algorithms/jumpgame.cpp

Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
This commit is contained in:
Rakshaa Viswanathan
2020-09-15 12:34:12 +05:30
committed by GitHub
parent 3ef35382a9
commit 4aea8495d6

View File

@@ -2,7 +2,7 @@
* @file
* @brief Implementation of an algorithm to solve the jumping game problem
* @details
* This algorithm is a greedy algorithm.
* **Problem statement:** Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index.
* This solution takes in input as a vector and output as a boolean to check if you can reach the last position.
* We name the indices good and bad based on whether we can reach the destination if we start at that position.
* We initialize the last index as lastPos.