TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Sliding Window Technique and 4 Questions (Algorithms Series)

1 pointsby soygulabout 5 years ago

1 comment

soygulabout 5 years ago
Hi all,<p>Sliding Window Technique is a method for finding subarrays in an array that satisfy given conditions. We do this via maintaining a subset of items as our window, and resize and move that window within the larger list until we find a solution. Sliding Window Technique is a subset of Dynamic Programming, and it frequently appears in algorithm interviews. In this video, you will learn how Sliding Window Technique works (with animations), tips and tricks of using it, along with its applications on some sample questions.<p>Video: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=jM2dhDPYMQM" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=jM2dhDPYMQM</a><p>Article: (same as title link) <a href="http:&#x2F;&#x2F;quanticdev.com&#x2F;algorithms&#x2F;dynamic-programming&#x2F;sliding-window" rel="nofollow">http:&#x2F;&#x2F;quanticdev.com&#x2F;algorithms&#x2F;dynamic-programming&#x2F;sliding...</a><p>In the video, you will find the solutions to the following questions, as well as their time and space complexities:<p><pre><code> • Easy: Statically Sized Sliding Window: Given an array of integers, find maximum&#x2F;minimum sum subarray of the required size. • Medium: Dynamically Sized Sliding Window: Given an array of positive integers, find the subarrays that add up to a given number. o Variation (Medium): Same question but for an array with all integers (positive, 0, negative). The optimal solution is Kadane&#x27;s Algorithm, but Sliding Window can still be applied with modifications (not recommended though). • Medium: Flipping&#x2F;Swapping: Given an array of 0&#x27;s and 1&#x27;s, find the maximum sequence of continuous 1&#x27;s that can be formed by flipping at-most k 0&#x27;s to 1&#x27;s. • Hard: Strings: Given a string and n characters, find the shortest substring that contains all the desired characters.</code></pre>