Return Count, Indices
Naive Sum/Average
while expand + while shrink
Indexes of Subarray Sum
Longest Substring - Depends on prev
while expand + rapid shrink
1759. Count Number of Homogenous Substrings
Medium1 solutionexplanationanalysis1 playground
Solutions:
1513. Number of Substrings With Only 1s
Less Than K (using atMost)
Idea: LessThan(k) = AtMost(k - 1)
while shrink
713. Subarray Product Less Than K
2302. Count Subarrays With Score Less Than K
Exactly K (using atMost)
Idea: Exactly(k) = AtMost(k) - AtMost(k - 1)
while shrink
1248. Count Number of Nice Subarrays
992. Subarrays with K Different Integers
930. Binary Subarrays With Sum
1358. Number of Substrings Containing All Three Characters
Medium1 solutionexplanationanalysis1 playground
Solutions:
2799. Count Complete Subarrays in an Array
2743. Count Substrings Without Repeating Character
Medium1 solutionexplanationanalysis1 playground
Solutions:
Exactly K (without atMost)
2537. Count the Number of Good Subarrays
2962. Count Subarrays Where Max Element Appears at Least K Times
Medium1 solutionexplanationanalysis1 playground
Solutions: