mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-02-12 23:15:52 +08:00
Update greedy_algorithms/jumpgame.cpp
Co-authored-by: Krishna Vedala <7001608+kvedala@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
3ef35382a9
commit
4aea8495d6
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user