Sliding Window Technique - Algorithmic Mental Models

Published: 23 June 2019
on channel: Ryan Schachte
359,468
11k

Please support me on Patreon:   / thesimpleengineer  
  / thesimpengineer     / schachte  
https://ryan-schachte.com

Don't forget to subscribe! Code:
https://gist.github.com/Schachte/87d7...

In this video, we'll begin our series of algorithmic mental models and cover the idea behind the sliding window technique. This technique allows us to reduce a typical n^2 algorithm to a linear time algorithm with minimal effort. This exploits linear time optimizations on data structures that deal with iteration and group sequential pieces of data together.

More resources:
  / sliding-window-technique  
https://thesimpleengineer.com
https://stackoverflow.com/questions/8...

Timestamps
00:00 Welcome
8:25 Maximum sum of contiguous subarray of size 3.
16:35 Question variants
24:50 Dynamic variant. Smallest subarray with given sum.
27:45 Smallest subarray code start
32:48 Smallest subarray solution
33:20 Longest substring with length k distinct characters


Watch video Sliding Window Technique - Algorithmic Mental Models online without registration, duration hours minute second in high quality. This video was added by user Ryan Schachte 23 June 2019, don't forget to share it with your friends and acquaintances, it has been viewed on our site 359,46 once and liked it 11 thousand people.