Sliding Window Algorithm Explained Clearly | Longest Substring Without Repeating Characters Leetcode

preview_player
Показать описание
leetcode, coding interview question, data structures, data structures and algorithms, faang
Рекомендации по теме
Комментарии
Автор

Master Data Structures & Algorithms For FREE at AlgoMap.io!

GregHogg
Автор

Always have trouble visualizing sliding window keep it up dawg

gabedailey
Автор

This is a great video. It just gives you the main idea needed.

And that’s really what we all need for learning about how to code these.

mfaani
Автор

These are helping me with LeetCode while in my freshmen year.🚀

va
Автор

Excellent explanation.
Why am I watching this on a Saturday night?

davea
Автор

if you're using a string you could just use an array of the size if the number of alphabets. Then you could just index the array with something like ['z' - curr_char ]. You still get the access in constant time without the overhead of a hashing function and all you trade for it is a few extra bytes for the array.

I really think people should try to do these problems without using built-in data structures and instead should try to implement their own as that helps you so much in getting a better understanding of these algorithms and programming im general.

kursh
Автор

In java if they are English alphabets use can use an array with a being 0 index b being 1 index and so on

boring-person-rishabh
Автор

dude i used to watch you on ig when you abrey had followrrs wow

mohitc
Автор

How simple you want to make it?
Greg: YES

smash
Автор

Great series, just read up on how to do the visualizing and you will have thousands of followers in no time. Quality > quantity, every time.

Edit: also, don’t zoom in as much, you’re constantly clipping the sides of the code snippets off. Set a text width of 60 or zoom out to like 50%. Most phones nowadays have great resolution so if anything we can pinch to zoom at our preference.

MrEo
Автор

I did the same thing, but rather than using a for loop, I did it using recursion

priyankrajvansh
Автор

what's the difference between sliding window vs 2 pointer?

vetiarvind
Автор

As I see it there are two variations to the sliding window, based on what I’ve seen so far. Set subset length(in which you move the right pointer until you get to that length, at which point you can increment both left and right to maintain that length) or undetermined subset length like this, which is based on some condition before you set left = right to start a new subset altogether.

Is this correct?

darcash
Автор

So seeing as how s[r] will always be in the set, can i clear the set, add s[r] to it, and say l = r? I’m trying to get rid of the while loop

doodledude
Автор

So that's where I was wrong. I was using a hashmap instead. And clearing the map when there was a repeat. I never thought of learning this algorithm as I wanted to come up with it naturally but then again I still have hadhset to learn. So I'm still learning.

HR-pzts
Автор

Please add time and space complexity for all the problems

prasadyous
Автор

What is the difference between a set and a hash set ?

anshusarkar
Автор

I have a question if I try to solve the same problem using other techniques Leetcode says Error even though my code is correct. Does Leetcode expect us to solve the problem using only one approach?

methodsystem
Автор

Hi should i use cpp over python due to TLE issue??

MSEditzzzzzz
Автор

hmm so is this another expression for two pointers ?

deleteduser
join shbcf.ru