diff --git a/greedy_algorithms/jumpgame.cpp b/greedy_algorithms/jumpgame.cpp index fb7ceb06f..6a2e75840 100644 --- a/greedy_algorithms/jumpgame.cpp +++ b/greedy_algorithms/jumpgame.cpp @@ -23,7 +23,7 @@ * @param array of numbers containing the maximum jump (in steps) from that index * @returns bool value whether final index can be reached or not */ -bool canJump(std::vector nums) { +bool canJump(const std::vector &nums) { auto lastPos = nums.size() - 1; for (auto i = nums.size() - 1; i >= 0; i--) { if (i + nums[i] >= lastPos) {