You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|[Leetcode-2965](https://leetcode.com/problems/find-missing-and-repeated-values/)| Find Missing And Repeated Values |[c++](./leetcode/2965.find-missing-and-repeated-values.cpp), [python3](./leetcode/2965.find-missing-and-repeated-values.py)| Math | O\(N^2\)| O\(N^2\)| - |
120
121
|[Leetcode-2269](https://leetcode.com/problems/find-the-k-beauty-of-a-number/)| Find The K Beauty Of A Number |[c++](./leetcode/2269.find-the-k-beauty-of-a-number.cpp), [python3](./leetcode/2269.find-the-k-beauty-of-a-number.py)| Math | O\(N\)| O\(N\)| - |
121
122
|[Leetcode-2698](https://leetcode.com/problems/find-the-punishment-number-of-an-integer/)| Find The Punishment Number Of An Integer |[c++](./leetcode/2698.find-the-punishment-number-of-an-integer.cpp), [python3](./leetcode/2698.find-the-punishment-number-of-an-integer.py)| Math | O\(N \* 2^K\)| O\(K\)| - |
122
123
|[Leetcode-202](https://leetcode.com/problems/happy-number/)| Happy Number |[c++](./leetcode/202.happy-number.cpp), [python3](./leetcode/202.happy-number.py)| Math | O\(S\)| O\(1\)| - |
|[Leetcode-3048](https://leetcode.com/problems/earliest-second-to-mark-indices-i/)| Earliest Second To Mark Indices I |[c++](./leetcode/3048.earliest-second-to-mark-indices-i.cpp), [python3](./leetcode/3048.earliest-second-to-mark-indices-i.py)| Binary Search | O\(NlogN\)| O\(N\)| - |
|[Leetcode-2024](https://leetcode.com/problems/maximize-the-confusion-of-an-exam/)| Maximize The Confusion Of An Exam |[c++](./leetcode/2024.maximize-the-confusion-of-an-exam.cpp), [python3](./leetcode/2024.maximize-the-confusion-of-an-exam.py)| Binary Search | O\(N\)| O\(1\)| - |
405
406
|[Leetcode-2779](https://leetcode.com/problems/maximum-beauty-of-an-array-after-applying-operation/)| Maximum Beauty Of An Array After Applying Operation |[c++](./leetcode/2779.maximum-beauty-of-an-array-after-applying-operation.cpp), [python3](./leetcode/2779.maximum-beauty-of-an-array-after-applying-operation.py)| Binary Search | O\(NlogN\)| O\(1\)| - |
406
407
|[Leetcode-2529](https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/)| Maximum Count Of Positive Integer And Negative Integer |[c++](./leetcode/2529.maximum-count-of-positive-integer-and-negative-integer.cpp), [python3](./leetcode/2529.maximum-count-of-positive-integer-and-negative-integer.py)| Binary Search | O\(logN\)| O\(1\)| - |
408
+
|[Leetcode-2106](https://leetcode.com/problems/maximum-fruits-harvested-after-at-most-k-steps/)| Maximum Fruits Harvested After At Most K Steps |[c++](./leetcode/2106.maximum-fruits-harvested-after-at-most-k-steps.cpp), [python3](./leetcode/2106.maximum-fruits-harvested-after-at-most-k-steps.py)| Binary Search | O\(N\)| O\(1\)| - |
407
409
|[Leetcode-718](https://leetcode.com/problems/maximum-length-of-repeated-subarray/)| Maximum Length Of Repeated Subarray |[c++](./leetcode/718.maximum-length-of-repeated-subarray.cpp), [python3](./leetcode/718.maximum-length-of-repeated-subarray.py)| Binary Search | O\(NM\)| O\(NM\)| - |
408
410
|[Leetcode-1235](https://leetcode.com/problems/maximum-profit-in-job-scheduling/)| Maximum Profit In Job Scheduling |[c++](./leetcode/1235.maximum-profit-in-job-scheduling.cpp), [python3](./leetcode/1235.maximum-profit-in-job-scheduling.py)| Binary Search | O\(NlogN\)| O\(N\)| - |
409
411
|[Leetcode-2271](https://leetcode.com/problems/maximum-white-tiles-covered-by-a-carpet/)| Maximum White Tiles Covered By A Carpet |[c++](./leetcode/2271.maximum-white-tiles-covered-by-a-carpet.cpp), [python3](./leetcode/2271.maximum-white-tiles-covered-by-a-carpet.py)| Binary Search | O\(NlogN\)| O\(1\)| - |
|[Leetcode-863](https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/)| All Nodes Distance K In Binary Tree |[c++](./leetcode/863.all-nodes-distance-k-in-binary-tree.cpp), [python3](./leetcode/863.all-nodes-distance-k-in-binary-tree.py)| Hash Table | O\(N\)| O\(N\)| - |
|[Leetcode-438](https://leetcode.com/problems/find-all-anagrams-in-a-string/)| Find All Anagrams In A String |[c++](./leetcode/438.find-all-anagrams-in-a-string.cpp), [python3](./leetcode/438.find-all-anagrams-in-a-string.py)| Hash Table | O\(N\)| O\(K\)| - |
483
485
|[Leetcode-448](https://leetcode.com/problems/find-all-numbers-disappeared-in-an-array/)| Find All Numbers Disappeared In An Array |[c++](./leetcode/448.find-all-numbers-disappeared-in-an-array.cpp), [python3](./leetcode/448.find-all-numbers-disappeared-in-an-array.py)| Hash Table | O\(N\)| O\(1\)| - |
484
486
|[Leetcode-1261](https://leetcode.com/problems/find-elements-in-a-contaminated-binary-tree/)| Find Elements In A Contaminated Binary Tree |[c++](./leetcode/1261.find-elements-in-a-contaminated-binary-tree.cpp), [python3](./leetcode/1261.find-elements-in-a-contaminated-binary-tree.py)| Hash Table | O\(N\)| O\(N\)| - |
|[Leetcode-3160](https://leetcode.com/problems/find-the-number-of-distinct-colors-among-the-balls/)| Find The Number Of Distinct Colors Among The Balls |[c++](./leetcode/3160.find-the-number-of-distinct-colors-among-the-balls.cpp), [python3](./leetcode/3160.find-the-number-of-distinct-colors-among-the-balls.py)| Hash Table | O\(N\)| O\(N\)| - |
|[Leetcode-1838](https://leetcode.com/problems/frequency-of-the-most-frequent-element/)| Frequency Of The Most Frequent Element |[c++](./leetcode/1838.frequency-of-the-most-frequent-element.cpp), [python3](./leetcode/1838.frequency-of-the-most-frequent-element.py)| Prefix Sum | O\(NlogN\)| O\(1\)| - |
570
573
|[Leetcode-1208](https://leetcode.com/problems/get-equal-substrings-within-budget/)| Get Equal Substrings Within Budget |[c++](./leetcode/1208.get-equal-substrings-within-budget.cpp), [python3](./leetcode/1208.get-equal-substrings-within-budget.py)| Prefix Sum | O\(N\)| O\(1\)| - |
571
574
|[Leetcode-1004](https://leetcode.com/problems/max-consecutive-ones-iii/)| Max Consecutive Ones III |[c++](./leetcode/1004.max-consecutive-ones-iii.cpp), [python3](./leetcode/1004.max-consecutive-ones-iii.py)| Prefix Sum | O\(N\)| O\(1\)| - |
572
575
|[Leetcode-2024](https://leetcode.com/problems/maximize-the-confusion-of-an-exam/)| Maximize The Confusion Of An Exam |[c++](./leetcode/2024.maximize-the-confusion-of-an-exam.cpp), [python3](./leetcode/2024.maximize-the-confusion-of-an-exam.py)| Prefix Sum | O\(N\)| O\(1\)| - |
576
+
|[Leetcode-2106](https://leetcode.com/problems/maximum-fruits-harvested-after-at-most-k-steps/)| Maximum Fruits Harvested After At Most K Steps |[c++](./leetcode/2106.maximum-fruits-harvested-after-at-most-k-steps.cpp), [python3](./leetcode/2106.maximum-fruits-harvested-after-at-most-k-steps.py)| Prefix Sum | O\(N\)| O\(1\)| - |
573
577
|[Leetcode-1423](https://leetcode.com/problems/maximum-points-you-can-obtain-from-cards/)| Maximum Points You Can Obtain From Cards |[c++](./leetcode/1423.maximum-points-you-can-obtain-from-cards.cpp), [python3](./leetcode/1423.maximum-points-you-can-obtain-from-cards.py)| Prefix Sum | O\(N\)| O\(1\)| - |
574
578
|[Leetcode-2271](https://leetcode.com/problems/maximum-white-tiles-covered-by-a-carpet/)| Maximum White Tiles Covered By A Carpet |[c++](./leetcode/2271.maximum-white-tiles-covered-by-a-carpet.cpp), [python3](./leetcode/2271.maximum-white-tiles-covered-by-a-carpet.py)| Prefix Sum | O\(NlogN\)| O\(1\)| - |
575
579
|[Leetcode-1658](https://leetcode.com/problems/minimum-operations-to-reduce-x-to-zero/)| Minimum Operations To Reduce X To Zero |[c++](./leetcode/1658.minimum-operations-to-reduce-x-to-zero.cpp), [python3](./leetcode/1658.minimum-operations-to-reduce-x-to-zero.py)| Prefix Sum | O\(N\)| O\(1\)| - |
|[Leetcode-643](https://leetcode.com/problems/maximum-average-subarray-i/)| Maximum Average Subarray I |[c++](./leetcode/643.maximum-average-subarray-i.cpp), [python3](./leetcode/643.maximum-average-subarray-i.py)| Sliding Window | O\(N\)| O\(1\)| - |
748
752
|[Leetcode-2779](https://leetcode.com/problems/maximum-beauty-of-an-array-after-applying-operation/)| Maximum Beauty Of An Array After Applying Operation |[c++](./leetcode/2779.maximum-beauty-of-an-array-after-applying-operation.cpp), [python3](./leetcode/2779.maximum-beauty-of-an-array-after-applying-operation.py)| Sliding Window | O\(NlogN\)| O\(1\)| - |
749
753
|[Leetcode-1695](https://leetcode.com/problems/maximum-erasure-value/)| Maximum Erasure Value |[c++](./leetcode/1695.maximum-erasure-value.cpp), [python3](./leetcode/1695.maximum-erasure-value.py)| Sliding Window | O\(N\)| O\(N\)| - |
754
+
|[Leetcode-2106](https://leetcode.com/problems/maximum-fruits-harvested-after-at-most-k-steps/)| Maximum Fruits Harvested After At Most K Steps |[c++](./leetcode/2106.maximum-fruits-harvested-after-at-most-k-steps.cpp), [python3](./leetcode/2106.maximum-fruits-harvested-after-at-most-k-steps.py)| Sliding Window | O\(N\)| O\(1\)| - |
750
755
|[Leetcode-718](https://leetcode.com/problems/maximum-length-of-repeated-subarray/)| Maximum Length Of Repeated Subarray |[c++](./leetcode/718.maximum-length-of-repeated-subarray.cpp), [python3](./leetcode/718.maximum-length-of-repeated-subarray.py)| Sliding Window | O\(NM\)| O\(NM\)| - |
751
756
|[Leetcode-3090](https://leetcode.com/problems/maximum-length-substring-with-two-occurrences/)| Maximum Length Substring With Two Occurrences |[c++](./leetcode/3090.maximum-length-substring-with-two-occurrences.cpp), [python3](./leetcode/3090.maximum-length-substring-with-two-occurrences.py)| Sliding Window | O\(N\)| O\(N\)| - |
752
757
|[Leetcode-1297](https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring/)| Maximum Number Of Occurrences Of A Substring |[c++](./leetcode/1297.maximum-number-of-occurrences-of-a-substring.cpp), [python3](./leetcode/1297.maximum-number-of-occurrences-of-a-substring.py)| Sliding Window | O\(N\)| O\(N^2\)| - |
// Tag: Array, Binary Search, Sliding Window, Prefix Sum
2
+
// Time: O(N)
3
+
// Space: O(1)
4
+
// Ref: -
5
+
// Note: -
6
+
7
+
// Fruits are available at some positions on an infinite x-axis. You are given a 2D integer array fruits where fruits[i] = [positioni, amounti] depicts amounti fruits at the position positioni. fruits is already sorted by positioni in ascending order, and each positioni is unique.
8
+
// You are also given an integer startPos and an integer k. Initially, you are at the position startPos. From any position, you can either walk to the left or right. It takes one step to move one unit on the x-axis, and you can walk at most k steps in total. For every position you reach, you harvest all the fruits at that position, and the fruits will disappear from that position.
9
+
// Return the maximum total number of fruits you can harvest.
0 commit comments