From d8f3b40085619cb680c8f227c65a1f5acc393223 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 23 Feb 2021 21:07:19 +0800 Subject: Move leetcode solutions to subdir. --- cpp/55.cpp | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 cpp/55.cpp (limited to 'cpp/55.cpp') diff --git a/cpp/55.cpp b/cpp/55.cpp deleted file mode 100644 index d2c2600..0000000 --- a/cpp/55.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include - -using std::vector; - -#include - -class Solution -{ -public: - bool canJump(vector &nums) - { - int max = 0; - const int size = nums.size(); - for (int i = 0; i < size; i++) - { - if (i <= max) - { - max = std::max(max, i + nums[i]); - if (max >= size - 1) - return true; - } - else - { - return false; - } - } - return false; - } -}; \ No newline at end of file -- cgit v1.2.3