TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Sliding Window Technique and 4 Questions (Algorithms Series)

1 点作者 soygul大约 5 年前

1 comment

soygul大约 5 年前
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>