Table of Contents: The Problem Introduction 0:00 - 1:31 Walking Through The Brute Force 1:31 - 4:19 Analyzing The Brute Force Solution 4:19 - 6:58 Lower Bounding The Brute Force 6:58 - 10:25 Let's Think Harder: Reapproaching Things 10:25 - 13:03 First Satisfying Window Found 13:03 - 13:51 We Now Make A Key Choice 13:51 - 17:43 Observing The Work The More Optimal Solution Does 17:43 - 19:25 Time Complexity 19:25 - 20:35 Space Complexity 20:35 - 21:36 Wrap Up 21:36 - 22:14 The code for both Brute Force and Optimal solutions are in the link in the description. Fully commented for teaching purposes.
@akhilesh_singla5 жыл бұрын
Please pin this.
@BackToBackSWE5 жыл бұрын
sure
@akhilk51215 жыл бұрын
The link to the code is broken.
@mmfawzy48504 жыл бұрын
Boss no link for the code !
@023ankit4 жыл бұрын
@@BackToBackSWE no code in description?
@aholagunju5 жыл бұрын
Why am I just discovering this channel? This is the best explanation I have seen so far. Makes it look simple as "abc". Thank you Ben.
@BackToBackSWE5 жыл бұрын
haha sure
@SameerSrinivas5 жыл бұрын
Thanks a lot for choosing intuition based approach. This is the most important skill in problem solving. Thanks for your time and energy spent making these videos and for writing beautiful code. Was able to understand with no confusion. Those are very intuitive variable names! Keep rocking!!!
@BackToBackSWE5 жыл бұрын
thanks
@vivekgr30015 жыл бұрын
Just love the way he explains.
@Egrodo15 жыл бұрын
No request, just major kudos. Your videos are by far the best leetcode explanations I've seen, please keep it up.
@BackToBackSWE5 жыл бұрын
I'm trying to improve daily. Teaching is hard. It is one thing to know something. But I have to sit myself down and say...how do I communicate this? The effectiveness of a teaching is inversely proportional to the number of people you lose at each great intellectual "leap" (as I always say) a concept requires.
@doruwyl5 жыл бұрын
I've watched a lot of video explanations to different coding problems. But I can say for sure that your way of explaining things is by far the best I've seen so far. I consider that you really try your best to make the audience to understand the solution to the problem rather than just showing a problem. Well done! I hope you will keep up posting new videos! Definetively this channel should have a lot more subscribers.
@BackToBackSWE5 жыл бұрын
yeah I will keep posting - and thanks haha, I've been at this for a while with little viewers
@neerumittal90283 жыл бұрын
This is the most knowledge enhancing video i have seen for ds problems and it is to the point. keep the work good up.
@BackToBackSWE3 жыл бұрын
Elated to hear that! Explore some awesome videos in our DSA course by subscribing on our website using "KZbin40" for a 40% discount - backtobackswe.com/pricing
@xsnowcappedx5 жыл бұрын
Man I just graduated and started job hunting. These videos have finally made everything I've studied start to come together ( I really couldn't understand a lot ). EVERY other video/explanation has been so confusing for me. You're genuinely giving me hope. Keep this up I really appreciate it. Do you plan to cover any kind of OOP design or system design/scalability questions?
@BackToBackSWE5 жыл бұрын
Hope is the goal. And...yeah I want to do an OOP/system design thing but for that I need more independent study. I read "Clean Code" and "Clean Architecture" by Robert C. Martin. "Clean Architecture" is a fantastic, amazing, complete, book on good Object Oriented design and designing scalable OO systems. And comments like this inspire me but make me sad too. I have hundreds of more quality videos in me...will the world ever see them? ... This project will take at least a year to develop into the minimum of what I want it to be. That makes me sad. A lot of hard work and lonely days ahead in front of a computer screen...but it's ok.
@kellyxiao30605 жыл бұрын
@@BackToBackSWE you did really really amazing work.
@BackToBackSWE5 жыл бұрын
@@kellyxiao3060 haha thanks
@sahil_cse_guy26845 жыл бұрын
@@BackToBackSWE you will be more searched on youtube in coming months if you continue to explain like this.Never ever loose hope.GOod Luck!
@BackToBackSWE5 жыл бұрын
@@sahil_cse_guy2684 thx
@jral11274 жыл бұрын
It took me so long to finally find a resource that makes sense. Your video and website is easy to understand and pure gold. Glad I found your channel from this problem, thanks!
@dankokozar5 жыл бұрын
Brilliant. I believe it's very hard to edit the video in a stop-motion fashion and you're making that effort. That makes your videos interesting from start to end. I also like big and clear letters (visible on tablet). Kudos!
@BackToBackSWE5 жыл бұрын
Interesting, thanks
@jordanmoore72985 жыл бұрын
Wonderful video. You made what could be a confusing concept into a clear one. I feel immensely more powerful behind the keyboard now!
@BackToBackSWE5 жыл бұрын
haha nice
@ponderatulify3 жыл бұрын
You are a WONDERFUL educator. That's how my mind works. I can't go full abstract from the get-go. I start simple from a concrete case, specific case, then I can generalize. Always thought this was wrong, because I wasn't able to REMEMBER solutions... . Thank you man.
@namratam15225 жыл бұрын
Hi Ben, I had been searching for these all problems to be explained around "Why" and "How", you have made me stop my search and I struggle to believe that someone could teach better than my expectations. I am from India and love the way you teach, amazing man.
@BackToBackSWE5 жыл бұрын
hey -Ben
@James-yz4cc5 жыл бұрын
The clearest explanation on KZbin. You deserve way more subs!
@BackToBackSWE5 жыл бұрын
ye
@xiuwenzhong73755 жыл бұрын
thanks a lot for hint of this problem. Using one HashMap to store all the target character and the times they need to show. Once the value change to 0, match length + 1, (when fast point move), once the value change from 0 to 1, match length - 1, the way to check current substring is contain target string, we can use matchLength == map.size().
@BackToBackSWE4 жыл бұрын
I haven't replied to this for a bit, replying to close this out in my "unresponded to comments" feed.
@abhishekbhaware67194 жыл бұрын
very very thank you, sir, the way you approach is just like feeding a baby right from scratch it's just awesome this problem is right now in your assignment and I don't know how to solve it but by this, I can very easily do it
@BackToBackSWE4 жыл бұрын
nice
@aasthamehtatech4 жыл бұрын
I'll mark today's date by this comment, I really did watch a few ur videos earlier, but today is when I realised the beauty of it! All this time, I jumped to problem solving directly, hoping to learn algorithm or even come up with 'em when I solve problems, now I do realise that first we need to understand the concept that deep, know y we r doing it & only then we'll able to come up with beautiful efficient soln. Also, I did like ur way of transitioning from intuitive brute force to an efficient one, that makes the content even more relatable. Thanks @BackToBackSWE :)
@BackToBackSWE4 жыл бұрын
Thanks for the nice words -Ben
@TheRahul5995 жыл бұрын
I was just finding a teacher like you who teaches how to think, really you are a great teacher Sir......Lots of love and respect from India......
@BackToBackSWE5 жыл бұрын
thanks haha, love from San Francisco
@kaushtubrawat82235 жыл бұрын
I was solving some questions by myself and had doubts in some of them such as this one..and i came across your videos ..i must say you have put a lot of hard work in explanation and also in editing of your videos..hats off..SUBSCRIBED :)
@BackToBackSWE5 жыл бұрын
thanks
@jlpeng90362 жыл бұрын
thank you man! your explain is wonderful!!! a lot of people tried to explain their code, but you are the first one explaining how the idea (the way we should think) to solve it without coding part. i now understand it!
@pranavganorkar23794 жыл бұрын
One of the most readable codes - 100 times better than those on leetcode discuss - Very easy to understand for anyone - Actually had figured out the approach before watching your video - But had problems implementing it myself - Thanks Ben !
@BackToBackSWE4 жыл бұрын
Nice, thx
@pranavganorkar23794 жыл бұрын
@@BackToBackSWE Just a small suggestion in your optimal code - We can maintain the frequency mapping only for required characters (those present in String t) in 'windowCharacterMapping' hashmap - As we do not care for characters which are not present in String t
@HumalDiscover4 жыл бұрын
You suddenly make the problem so easy to understand by abstracting and explaining the main thing. Thanks
@BackToBackSWE4 жыл бұрын
sure
@RahulVerma-fz2jf4 жыл бұрын
Really good work man. The best part is you, explaining the thinking process of how to go about optimizing brute to a better solution. Keep up the good work .
@BackToBackSWE4 жыл бұрын
thanks and ok
@edwardnewgate21985 жыл бұрын
Amazing work dude- I'm a fan of your code explanations! Keep em coming
@BackToBackSWE5 жыл бұрын
aw
@biswamohandwari64604 жыл бұрын
You explain like a real man... Amazing
@BackToBackSWE4 жыл бұрын
lol thx
@kratigupta803 жыл бұрын
You are doing a fantastic job I must say, and I just now saw your platform where u have put code, solution, video all at one place, and it is God level.
@liingpangryantee72034 жыл бұрын
It makes so much sense when you understood the technique, but man no way would I be able to come up with this technique in an interview
@RagazzoKZ5 жыл бұрын
You are the best teacher man! Thanks!
@BackToBackSWE5 жыл бұрын
sure
@kannappansuresh24472 жыл бұрын
crystal clear explanation, thanks man. got stuck with problem for two days, I wanted a in-depth explanation of the algorithm and you provided it!
@atibhiagrawal64605 жыл бұрын
I have an interview of Monday and your videos are the besttttt
@BackToBackSWE5 жыл бұрын
nice
@AI_For_Scientists2 жыл бұрын
teaching is an art and you are gifted with that. thank you!
@BackToBackSWE2 жыл бұрын
Thanks! try out my 5 day free mini course for some good content backtobackswe.com/
@asittripathy17784 жыл бұрын
I am a fan of your code explanations. I must say great way to explain something in very simple way.
@BackToBackSWE4 жыл бұрын
thx
@MrAlus32 жыл бұрын
Oh boy, oh boy. This is very good explanation. When you said this issue is consider "hard" I was suprised, since you made it so easy by breaking down this brute force and optimal solution. Cheers
@BackToBackSWE2 жыл бұрын
haha thanks! Means a lot
@Yunnn_life5 жыл бұрын
Doing leetcode for 2 days and I saw you 3 times! Subscribed!
@BackToBackSWE5 жыл бұрын
hey
@satyadeeproat20124 жыл бұрын
I was confused while solving leetcode Sliding window questions. Leetcode discussion section didn't help. Watched this video and now I am able to solve most of sliding window medium level questions in 15-20mins. Thanks for the video
@BackToBackSWE4 жыл бұрын
haha great
@MAK280319915 жыл бұрын
One thing which will take you forward in this domain is the way to you approach problem and optimize it further. Keep it up. All the best.
@BackToBackSWE5 жыл бұрын
nice
@adithyabhat47705 жыл бұрын
I really like your approach of teaching, you start with brute force and then go on improving that. Thanks!
@BackToBackSWE5 жыл бұрын
sure
@sophiehall385 жыл бұрын
Expand the window until it satisfies, then contract the window. Nice explanation!
@BackToBackSWE5 жыл бұрын
thanks. hey.
@darshantsdarshan14 жыл бұрын
Somebody give this guy a medal!
@BackToBackSWE4 жыл бұрын
ok
@cbverma2k4 жыл бұрын
One of best explanation of complexity analysis .. keep going ... many likes
@BackToBackSWE4 жыл бұрын
sure
@nikhil.pandey5 жыл бұрын
it's my 1st video on this channel............... and guess what? I love it by your approach to the solution .!!
@BackToBackSWE5 жыл бұрын
nice
@shashankkumarshankar36555 жыл бұрын
You explain in such low level details with focus on the "why" than just the "how" makes you a 1000 times better than Tushar Roy's videos :P. Great work! I am pretty sure you would be great to work with in real software engineering.
@BackToBackSWE5 жыл бұрын
thanks lol, tell that to all the companies that have rejected me 😳😳
@southern-sunshine5 жыл бұрын
@@BackToBackSWE completely agree with shashank. BTW it's loss of companies which rejected you 😀
@BackToBackSWE5 жыл бұрын
@@southern-sunshine ye
@shashankkumarshankar36555 жыл бұрын
Back To Back SWE haha. Yeah it happens. Interviews are okay with false negatives than false positives. Unfortunately that's the nature of it and nothing can be done.
@BackToBackSWE5 жыл бұрын
@@shashankkumarshankar3655 ye
@ramadaskamat64184 жыл бұрын
I wish I found this channel earlier, u r so good
@BackToBackSWE4 жыл бұрын
welcome & no ur gud
@kirancoding15765 жыл бұрын
I can only say ,"YOU ARE THE BEST"
@BackToBackSWE5 жыл бұрын
no, I'm decent
@QVL752 жыл бұрын
I really like the way you explained this problem. Very logical and easy to understand. Thank you!
@fibber70625 жыл бұрын
Thank you for all the work you put into creating these videos! You're awesome!
@BackToBackSWE5 жыл бұрын
nah, u are
@vanshmittal7675 жыл бұрын
your teaching skill ismawesome man !!! love it
@BackToBackSWE5 жыл бұрын
thanks
@tianxiaowang37715 жыл бұрын
The Ω part is a little confused, but another part is very clear. Thanks, Ben. your video gives me a log help
@BackToBackSWE5 жыл бұрын
Sure. And watch this: kzbin.info/www/bejne/ZqCncp-DrLmlgtE
@fridagutierrezmireles11934 жыл бұрын
I love all of your videos, thank you for making me understand everything better!
@BackToBackSWE4 жыл бұрын
sure
@suhasnayak47045 жыл бұрын
Thanks! In the code while mentioning about time complexity instead of mentioning leetcode runtime, put it in terms of big o notation, that would be more helpful.
@BackToBackSWE5 жыл бұрын
good suggestion
@The8merp4 жыл бұрын
Thank you for the awesome explanation of both the algorithm and it's time and space complexity. I was struggling to understand the time and space complexity.
@BackToBackSWE4 жыл бұрын
sure
@tushargoyal38045 жыл бұрын
You are a brilliant teacher!!!! You really built the concepts.
@BackToBackSWE5 жыл бұрын
thanks
@syedimam86635 жыл бұрын
Your explanations are the best in the world!
@BackToBackSWE5 жыл бұрын
thanks
@Chiving4 жыл бұрын
No way someone can come with this solution on 45 minutes
@BackToBackSWE4 жыл бұрын
Yeah
@kanishkkumar47464 жыл бұрын
I came to this idea just after seeing the solution and even when am not good !
@th3tagang4 жыл бұрын
you are not being interviewed on your experience, but on your ability to memorize these problems. I know people will claim, oh, there are concepts to understand, but the reality is your ability to develop object oriented systems cannot be determined with hundreds of algorithms that have their own niche.... Unfortunately, we are perpetuating this by studying for interviews...
@kanishkkumar47464 жыл бұрын
@@th3tagang you are wrong buddy there are people who can solve problems without doing leetcoding (i.e. memorizing problems ) , an extreme example can be Gennady korotkevich !
@zlmsailor3 жыл бұрын
@@kanishkkumar4746 You could not possibly find tens of thousands of them to meet the demand of FAANG.
@jishulayek82525 жыл бұрын
Excellent explanation!!! Really like to watch and learn from your tutorials.
@BackToBackSWE5 жыл бұрын
sure
@djlivestreem40393 жыл бұрын
you're the best bro seriously never stop please
@ibrahimt094 жыл бұрын
Very well explained!!! Thank you very much for taking the time and effort to walk through in this depth!
@BackToBackSWE4 жыл бұрын
sure
@Maulmota5 жыл бұрын
Excellent and clear explanation. In a sea of heavy accents and confusing explanations, you video is like water in the desert. Thanks!
@BackToBackSWE5 жыл бұрын
thanks hahaha 🏜️💧
@jakefromstatefarm39544 жыл бұрын
absolutely brilliant! thanks for taking a chance on us!
@xiaotongyan53945 жыл бұрын
great explanation. I don't know how to thank you. I really like the transition from a brute force solution to an optimal one.
@BackToBackSWE5 жыл бұрын
sure
@gregoryrobertson4 жыл бұрын
Great explanation for both brute force and linear solution.
@BackToBackSWE4 жыл бұрын
Ye
@pallav294 жыл бұрын
Very nice explanation. Though the video is a bit lengthy compared to other videos online, but it makes concept crystal clear .
@BackToBackSWE4 жыл бұрын
ye
@watcher52324 жыл бұрын
Trust me, a very clear explanation. I will definitely donate when I pass my interview. lol
@harishgovindan4 жыл бұрын
Well explained!! Thanks!! I would like to know how the characters are search within the window using the hash table in O(1) time.
@BackToBackSWE4 жыл бұрын
I don't remember this problem well nor the solution enough to answer
@pranjalchoubey59294 жыл бұрын
Beautifully explained!
@BackToBackSWE4 жыл бұрын
thanks
@rohitprasad3653 жыл бұрын
Wow, This is the best explanation, Thank you for making our lives easier.
@Liokki4 жыл бұрын
Great explanation, thanks for the video. Helped me a lot in understanding the problem in preparation for an upcoming Facebook interview
@BackToBackSWE4 жыл бұрын
great.
@Tanu-br9bp4 жыл бұрын
Just love the way you explain things. Your videos are the best. Good job 👏 👍
@BackToBackSWE4 жыл бұрын
thanks! hey
@Tanu-br9bp4 жыл бұрын
@@BackToBackSWE Hi, I am stuck on this question (www.lintcode.com/problem/word-pattern-ii/description). Can you please create a video for the same.
@BaishaliGhosh135 жыл бұрын
Thank you. The example driven explanation really brings clarity to my understanding.
@BackToBackSWE5 жыл бұрын
nice
@laxatony5 жыл бұрын
Thanks for the clear explanation. You make the logic so easy to understand.
@BackToBackSWE5 жыл бұрын
sure
@enigma28864 жыл бұрын
I think I am dumb af, cOZ I hAve To KeEp rePlaYing ThE vIdEO EDIT: finally got it ! you genius teacher man !
@BackToBackSWE4 жыл бұрын
lol great
@sciphilo7544 жыл бұрын
Lovely intuitive explanation!
@BackToBackSWE4 жыл бұрын
Thank you!
@anonymoussloth66873 жыл бұрын
At 14:54, when the string didn't satisfy, why couldn't we move L back to where it was and R to next position? Then the new substring would be "zjsk" which satisfies. Why do we not explore this option?
@youlihanshu4 жыл бұрын
so well explained, such a clear quick course!
@rohitpal77394 жыл бұрын
best ! love how you cut videos
@BackToBackSWE4 жыл бұрын
thanks
@jamesdvc5 жыл бұрын
Very well explained! Saved my time and it is very helpful! Thank you!
@BackToBackSWE5 жыл бұрын
nice
@sreerampanigrahi4 жыл бұрын
It was a very well made with emphasis on important words and points. Loved the video and you earned a sub.
@BackToBackSWE4 жыл бұрын
welcome aboard 🚢
@RuthChirinos3 жыл бұрын
I've discovered the channel, great explanation, thanks!!
@brandonhui12985 жыл бұрын
was asked this by a big n, its a good problem
@BackToBackSWE5 жыл бұрын
hey
@brandonhui12985 жыл бұрын
@@BackToBackSWE is for horses
@BackToBackSWE5 жыл бұрын
@@brandonhui1298 yeah
@Mohith75484 жыл бұрын
Space complexity can be O(1) if we use array of len 26, rather than Hashtable.
@BackToBackSWE4 жыл бұрын
ok
@jenny34164 жыл бұрын
there's uppercase and lowercase, and they don't treat them as the same input: s="a", t="A" output: ""
@VijaySharma-hw4kv4 жыл бұрын
@@jenny3416 still O(1) space. if we consider all chars with 256 length
@DED_Search3 жыл бұрын
21:30 I understand that it takes O(t) to build the hash table, but since there are total 26 characters, wouldn’t it take O(1) to store the hash table? Thanks.
@tomshannon44812 жыл бұрын
Your videos are so helpful and clear.
@RDharini-yg1nm6 ай бұрын
Very Helpful, Fantastic Explanation
@BharCode095 жыл бұрын
OMG such neat intuitive explanation! Thanks for your efforts! Also, you have a lot of resemblance with one of my cousins and we are Indian! :)
@BackToBackSWE5 жыл бұрын
Ay, Indian fam
@himanshu7154 жыл бұрын
Nice Explanation. Keep Going
@BackToBackSWE4 жыл бұрын
ok.
@Hav0c10004 жыл бұрын
Wow... now that you explained it... I could code this with my eyes shut...
@BackToBackSWE4 жыл бұрын
nice
@ashishrawat7705 жыл бұрын
You are really a great teacher
@BackToBackSWE5 жыл бұрын
thx
@gurpartapsingh16934 жыл бұрын
Hey, brilliant job man. But I couldn't find the link to the code. Can you help me through it?
@BackToBackSWE4 жыл бұрын
The repository is deprecated, we only maintain backtobackswe.com now.
@deepakkhobragade52575 жыл бұрын
Awesome explanation! I really appreciate your efforts. Thanks!
@BackToBackSWE5 жыл бұрын
ye
@vekatasaiamulyapamidimukka70855 жыл бұрын
Awesome explanation. Thank you so much for making such good videos. Helping us a lot.
@BackToBackSWE5 жыл бұрын
sure, may the internet flourish
@AngadSingh974 жыл бұрын
Really nicely explained, thanks man!
@BackToBackSWE4 жыл бұрын
sure
@johnlabarge5 жыл бұрын
Amazing explanation. You're awesome at this.
@BackToBackSWE5 жыл бұрын
thanks
@2k7Bertram2 жыл бұрын
Beautifully explained. Thanks!
@BackToBackSWE2 жыл бұрын
Thank You, Glad you liked it. Do check out backtobackswe.com/platform/content and please recommend us to your family and friends :)
@ateebahmed22374 жыл бұрын
you earned a sub man
@BackToBackSWE4 жыл бұрын
welcome
@muneerhasan5 жыл бұрын
Deserve one like from India
@BackToBackSWE5 жыл бұрын
welcome
@willturner34404 жыл бұрын
Congratulations sir you got a new subscriber 🥳🥳
@BackToBackSWE4 жыл бұрын
welcome aboard
@jeffenriquez99294 жыл бұрын
Thank you! I was struggling with this.
@BackToBackSWE4 жыл бұрын
glad it helped
@christopherragasa17245 жыл бұрын
You deserve more subs!
@BackToBackSWE5 жыл бұрын
working on it.
@shashikantdivekar78394 жыл бұрын
Very good explanation. Thank you Sir for this quality video.
@zhanginou5 жыл бұрын
Super clear man, thanks!
@BackToBackSWE5 жыл бұрын
sure
@gkrithika75523 жыл бұрын
Awesome video with great explanation. Thanks a lot for such amazing and easily understandable video