From 8622683556a05d935ff6cf2f88f286f80584d78a Mon Sep 17 00:00:00 2001 From: Rakshaa Viswanathan <46165429+rakshaa2000@users.noreply.github.com> Date: Tue, 1 Sep 2020 00:18:51 +0530 Subject: [PATCH] fixed bugs final --- greedy_algorithms/jumpgame.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/greedy_algorithms/jumpgame.cpp b/greedy_algorithms/jumpgame.cpp index 60b7edd35..7699abdc7 100644 --- a/greedy_algorithms/jumpgame.cpp +++ b/greedy_algorithms/jumpgame.cpp @@ -6,7 +6,7 @@ Determine if you are able to reach the last index.*/ #include #include -bool canJump(vector nums) { +bool canJump(std::vector nums) { auto lastPos = nums.size() - 1; for (auto i = nums.size() - 1; i >= 0; i--) { if (i + nums[i] >= lastPos) { @@ -16,8 +16,9 @@ bool canJump(vector nums) { return lastPos == 0; } -void main(){ +int main(){ //Sample test case - vector num={4,3,1,0,5}; + std::vector num={4,3,1,0,5}; cout<