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