Dutch National Flag problem leetcode

  Рет қаралды 9,137

Engineerhoon

Engineerhoon

3 жыл бұрын

#competitiveprogramming #leetcode #coding
This video is about how to approach a competitive programming problem starting from a naive approach to an optimal solution.
This is the Leetcode problem which is solved in three different solutions.
Problem link: leetcode.com/problems/sort-co...
GitHub link for Java and Kotlin solutions: bit.ly/3475EY6
For written content,
check out the blogger website: engineer-sunny.blogspot.com
Instagram: / engineerhooon
LinkedIn: / sunny-shaw
Medium: / sunnyshaw_12357
GitHub: github.com/sunny-shaw

Пікірлер: 48
@sktime6538
@sktime6538 3 жыл бұрын
space complexity of merge sort is O(n) right ?
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Yes, Thanks for pointing it out. I will pin your comment.
@ashelytang2592
@ashelytang2592 11 ай бұрын
Short and to the point. This was great, thank you!!
@Engineerhooon
@Engineerhooon 11 ай бұрын
Glad you find it helpful 🙌
@jankipatel118
@jankipatel118 3 жыл бұрын
awesome explanation , carry on sir, waiting for new problems
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Thanks! More videos coming soon. Do checkout the playlist for more videos.
@anukritisingh7204
@anukritisingh7204 2 жыл бұрын
Best video ever regarding dutch flag algo! Thanks for the explanation!
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Thanks!
@aravindpogu
@aravindpogu 3 жыл бұрын
Thanks for the explanation. This solution approach could be also used for problems like below: Given an array of ages, segregate them into 3 groups ( kid), (18-59 adult,) (>=60 senior)
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Yes
@mogilipoojitha3039
@mogilipoojitha3039 2 жыл бұрын
great explanation .Thank you..
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Thank you!
@bcyourself
@bcyourself 2 жыл бұрын
This is such an excellent explanation! Thank you so much!!!!
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Welcome!
@emmagraham1
@emmagraham1 Жыл бұрын
I watched 1000 videos on this and this one is the only one that helped. Thank you.
@Engineerhooon
@Engineerhooon Жыл бұрын
Thank you! It means a lot.
@tvsnath
@tvsnath 3 жыл бұрын
Thanks for the awesome explanation..
@Engineerhooon
@Engineerhooon 3 жыл бұрын
You're welcome!
@Jawahar-Engr.
@Jawahar-Engr. Жыл бұрын
Understood the algorithm , Thank you so much. Greatly helpful
@Engineerhooon
@Engineerhooon Жыл бұрын
Glad it helped!
@bishwashkumarsah171
@bishwashkumarsah171 2 жыл бұрын
nice explanation brother
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Thanks brother!
@Jawahar-Engr.
@Jawahar-Engr. Жыл бұрын
Please upload video based on sub array problem.. Like sub array with given sum, sliding window..
@Engineerhooon
@Engineerhooon Жыл бұрын
I have a few videos on these topics as well. Checkout the playlist here : kzbin.info/aero/PLF5kUO89mjNpe29aZH6quaqfms9GDaUnO
@satyavarmalutukurthi
@satyavarmalutukurthi 3 жыл бұрын
Great explanation.....
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Glad it was helpful. Many more to come.
@chandravijaya1410
@chandravijaya1410 2 жыл бұрын
Thank you
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Welcome!
@bhawnakumari7894
@bhawnakumari7894 3 жыл бұрын
Good explanation!
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Thanks Bhawna.
@sarithanaik2321
@sarithanaik2321 3 жыл бұрын
Thank you so much ... helped a lot
@Engineerhooon
@Engineerhooon 3 жыл бұрын
You're welcome!
@ashutoshrai2717
@ashutoshrai2717 2 жыл бұрын
Your explanation with figure is amazing
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Noted. Will follow same for future videos. ✔
@ashutoshrai2717
@ashutoshrai2717 2 жыл бұрын
@@Engineerhooon please bring some more videos on questions like sorting and searching algorithms it will really help
@Engineerhooon
@Engineerhooon 2 жыл бұрын
@@ashutoshrai2717 Noted :)
@ashutoshrai2717
@ashutoshrai2717 2 жыл бұрын
Very good explanation 👍👍
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Thanks!
@satyavarmalutukurthi
@satyavarmalutukurthi 3 жыл бұрын
Subscribed...
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Thanks! Please share with others for better reach.
@getsunova8894
@getsunova8894 Жыл бұрын
Excellent explanation for an overly complicated algorithm.
@Engineerhooon
@Engineerhooon Жыл бұрын
Thank you!
@agnelamodia
@agnelamodia 3 жыл бұрын
space complexity for Approach 2 is O (n) as we are using auxiliary space to store the frequencies of the elements. right?
@Engineerhooon
@Engineerhooon 3 жыл бұрын
Thanks for pointing it out. You are correct.
@aditigupta4795
@aditigupta4795 3 жыл бұрын
Thanks for the video but what is the intuition behind this solution? why do we move the specific pointers for particular conditions?
@Engineerhooon
@Engineerhooon 3 жыл бұрын
If you are familiar with quick sort algorithm you can relate the idea of using a pivot element to group all elements smaller than the pivot element to the left of the pivot element and group all elements larger than the pivot element to the right side of pivot element to get a sorted list of element. Similarly, here we are moving pointers based on specified conditions to group 0s, 1s and 2s. I would recommend you to watch it again, the video will make more sense now.
@ashutoshrai2717
@ashutoshrai2717 2 жыл бұрын
Sir please bring some more videos on algorithms
@Engineerhooon
@Engineerhooon 2 жыл бұрын
Noted!
Majority Element Leetcode | Moore's voting algorithm
14:46
Engineerhoon
Рет қаралды 284
The Dutch National Flag Problem (The Quicksort "Band-Aid")
10:54
Back To Back SWE
Рет қаралды 30 М.
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 44 МЛН
Это реально работает?!
00:33
БРУНО
Рет қаралды 3,6 МЛН
Советы на всё лето 4 @postworkllc
00:23
История одного вокалиста
Рет қаралды 4,7 МЛН
Maximum Product Subarray - Dynamic Programming - Leetcode 152
15:31
Towers of Hanoi: A Complete Recursive Visualization
21:13
Reducible
Рет қаралды 453 М.
Sort colors | Leetcode #75
6:02
Techdose
Рет қаралды 84 М.
The Most Successful People Explain Why a College Degree is USELESS
11:26
Motivation Madness
Рет қаралды 8 МЛН
Why Are People From The Netherlands Called Dutch?
5:02
Name Explain
Рет қаралды 778 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
Google Coding Interview With A Competitive Programmer
54:17
Clément Mihailescu
Рет қаралды 2,5 МЛН
Sort Colors - Quicksort Partition - Leetcode 75 - Python
15:48
Мой новый мега монитор!🤯
1:00
Корнеич
Рет қаралды 2,5 МЛН
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 4,7 МЛН
Как противодействовать FPV дронам
44:34
Стратег Диванного Легиона
Рет қаралды 123 М.