profile picture

2 pages tagged with "sliding window pattern"

Sliding Window Pattern - Part 2

July 21, 2021 - 893 words - 5 mins
In the first part covering the sliding window pattern, we saw how it can be applied to solve the maximum subarray sum problem. In this second part of the series, we'll demonstrate how we can use a sliding window of dynamic size, to solve more interesting problems, such as the fruit into baskets prob… read more

Sliding Window Pattern - Part 1

July 19, 2021 - 591 words - 3 mins
This is a commonly used pattern that can be utilized in solving a number of coding interview-type questions associated with arrays. When should one use this? Well, the problem description usually gives it away. Look out for problems which require inspecting, or calculating some value between elemen… read more