Master Data Structures & Algorithms For FREE at AlgoMap.io!
@vaibhavchetri88192 ай бұрын
Best Explanation. Its Crystal Clear
@AvinashKumar-d1i1pАй бұрын
Best explaINATION ON THIS TOPIC ON YT..
@middle-agedclimber6 ай бұрын
Best solution I've seen. Thanks
@HelicopterRidesForCommunists5 ай бұрын
lol thats literally what I said. Best explanation too.
@HussainAli-hn2ef3 ай бұрын
great explanation!
@pumpkinp69069 ай бұрын
Great explanation ! It would be great if you would share the leetcode problem link in description so that we can implement ourselves after learning
@HelicopterRidesForCommunists5 ай бұрын
Best solution Ive seen. Nice!
@Jay-zr8kxАй бұрын
instead of using set, using key value pair object, to track the last index a character is found so that {a:0, b:1, c:2}, then when a second a is found if we update the a index to {a:3, b:1, c:2} then left pointer to original a index +1, are we able to save the extra looping until finding valid substring?
@DamosyTheFreckle6 ай бұрын
Good explanation, thank you!
@ryan.aquino2 ай бұрын
Get the length of the set instead when comparing. Much easier to think intuitively
@kashinathpatekar98709 ай бұрын
Technically the size of the set will be limited by the character set used, so can we call it O(1) space?
@GregHogg9 ай бұрын
Oops did I say O(n) space? You're completely correct, yes!
@kashinathpatekar98709 ай бұрын
Thanks for clarifying!
@foudilbenouci4826 ай бұрын
more exactly O(n/c) where c is the capacity of the character set used and n the size of the string
@shashank51753 ай бұрын
@@foudilbenouci482 O(n/c) could be reduced to O(n) or am I wrong cause I thought you can reduce multiplication and division but can reduce addition and subtraction
@pravuchaudhary39043 ай бұрын
I have two questions: 1. insted of while loop , why not use if...else 2. after while loop: instead of removing and updating the char in sett, why not add string in sett first and start update "longest"
@rajarshibiswas94246 ай бұрын
i don't know why the code I have written is exactly same instead of set I used hash map should i have used hash set?? is hash map is the main cause of output limit exceeded??
@yuasufhelal71815 ай бұрын
It's a basic one but please I have question what if we use if s(r) in seen willl it be completely wrong but by what sense. Since you were using while.
@ParaSteve19859 ай бұрын
Hi there, are you still available for 1o1 trainings sessions?
@GregHogg9 ай бұрын
Yes, please email greg.hogg1@outlook.com
@ParaSteve19859 ай бұрын
@@GregHogg done, waiting for your reply.
@sumeethraikar7113 ай бұрын
set doesnt preserve insertion order. so how removing of elements is working here.?
@freshedits84083 ай бұрын
They are removing based on the actual character, but not with an index so it is working.
@salxs9664Ай бұрын
@@freshedits8408 Can you explain why it's not an index because I see sett.remove(s[l]) and then l += 1 so shouldn't it be removing sett at index 0 and then moving up? This is something that I am confused by as well. When you add items to the set the first item you add doesn't necessarily stay at index 0
@freshedits8408Ай бұрын
@@salxs9664 no, here s means string so we are removing a first index of the string Suppose if s[l] means "a" which is the first index in the string and we are removing "a" from the set like set.remove("a"). If the char already exists then we are removing it. Every time we remove, we are changing the starting index
@salxs9664Ай бұрын
@@freshedits8408 Thank you that explains it!
@ohskynyrdlynyrd4 сағат бұрын
"When window is valid we move R, when it's invalid we move L". Had to type it to memorize