Majority Element (LeetCode 169) | Full solution with 4 different methods | Interview Essential

preview_player
Показать описание
A majority candidate is defined as more than 50%. So in a given array of integers you have different methods to find it. Watch the video to learn 4 ways how you can start and ultimately arrive at an efficient solution. This video provides a perfect approach to attack this problem step by step with animations and visuals.

Chapters:
00:00 - Intro
00:51 - Problem Statement and Description
02:48 - Brute Force Solution
04:27 - Solution by Sorting
07:14 - Using a HashTable
09:35 - Moore’s Voting Algorithm O(1) space
12:14 - Dry-run of Code
13:47 - Final Thoughts

📚 Links to topics I talk about in the video:

📖 Reference Books:

🎥 My Recording Gear:

💻 Get Social 💻

#leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

Slick & straight! Thank you for breaking the complexity.

ruthikapamar
Автор

Keep making these videos bro, the quality is Amazing!

michaelagedie
Автор

You the one of the best here on YouTube, the way you teach, the way you keep every in a structured manner is super commendable. Subscribed.

sheldoncooper
Автор

Fan of you ! Such a clear and crisp explanation

Mydailymutualfundportfolio
Автор

Bro, the quality of your content is exceptional. You deserve more subscribers. Thank you brother.

Ramu_Sriram
Автор

After watching 5 videos finally understood ... kaafi acchaa explanation...loved it

negxativexd
Автор

You've explained in a very simple way!!

Rits
Автор

great solution as always. Thanks alot bhaiya please keep on making such amazing videos.

satyamgupta
Автор

Next level & Awesome explaination with cutest smile. Thank you😊

m.abrarsheikh
Автор

there's a small mistake in the dry run in moore's algo at last votes for majority 2 is 1, when majority reaches 3 the votes will be 0, so, majority will be updated in the next iteration so majority will be update as 1, please check, explanation is too good!!!

palanivelraju
Автор

Great video, you explained it so well.
Thanks !!

anonymous_n
Автор

Your teaching is superb. You have a new subscriber.

velocity
Автор

thank you, your dry run really helped

kunalkheeva
Автор

pls make a video on peak element ... your videos are so helpful!!!!

Hello-li
Автор

SO CLASSY AND please make the playlist of data structures important questions too

bhumikabansal
Автор

Shouldn’t there be a line to break out of loop if votes reached more than n/2? So that you don’t have to even loop completely through the array if you have found majority in the first half itself.

ramshankar
Автор

Great video man! Loved this explanation, you are highly underrated. If it's possible can you do python solutions as well for future leetcode videos? Thanks again!

mehbubrohit
Автор

it's tough to get an optimized solution 😔.... but I will try to reach it on my own 😊.

albingeorgekurian