diff --git a/Arrays/CheckAll1sAreAtLeastKPlacesAway.cpp b/Arrays/CheckAll1sAreAtLeastKPlacesAway.cpp index 81b4968..406fd8d 100644 --- a/Arrays/CheckAll1sAreAtLeastKPlacesAway.cpp +++ b/Arrays/CheckAll1sAreAtLeastKPlacesAway.cpp @@ -1,16 +1,33 @@ -static auto fast=[]{ios_base::sync_with_stdio(false);cin.tie(nullptr);return 0;}(); +// static auto fast=[]{ios_base::sync_with_stdio(false);cin.tie(nullptr);return 0;}(); +// class Solution { +// public: +// bool kLengthApart(vector& nums, int k) { +// int s=0; +// int c=0; +// while(s& nums, int k) { - int s=0; - int c=0; - while(s 0) return false; + // otherwise we either reset or decrease j + else j = nums[i] ? k : j - 1; } return true; } -}; \ No newline at end of file +};