diff --git a/greedy_algorithms/jumpgame.cpp b/greedy_algorithms/jumpgame.cpp index 2c33b9141..25c6f1c05 100644 --- a/greedy_algorithms/jumpgame.cpp +++ b/greedy_algorithms/jumpgame.cpp @@ -6,9 +6,9 @@ Determine if you are able to reach the last index.*/ #include #include using namespace std; -bool canJump(vector& nums) { +bool canJump(vector nums) { int lastPos = nums.size() - 1; - for (int i = nums.size() - 1; i >= 0; i--) { + for (auto i = nums.size() - 1; i >= 0; i--) { if (i + nums[i] >= lastPos) { lastPos = i; }