A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d6/dba/jump__game_8cpp_source.html below:

TheAlgorithms/C++: greedy_algorithms/jump_game.cpp Source File

Go to the documentation of this file. 43 size_t

lastPos = nums.size() - 1;

44 for

(

size_t

i = lastPos; i !=

static_cast<size_t>

(-1); i--) {

45 if

(i + nums[i] >= lastPos) {

51

}

// namespace greedy_algorithms 64

std::cout <<

"All tests have successfully passed!\n"

;

72 test

();

// run self-test implementations

static void test()

Function to test the above algorithm.

int main()

Main function.

bool can_jump(const std::vector< int > &nums)

Checks whether the given element (default is 1) can jump to the last index.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4