Can You Detect the Word Balloon? (LeetCode 1189: Maximum Number of Balloons)

  Рет қаралды 2,617

Code With Zi

Code With Zi

Күн бұрын

Пікірлер: 5
@toooplive
@toooplive Ай бұрын
I found your channel through recommendations. I applaud your effort in visualizing the entire logic. Perhaps might dive into LeetCode someday for the fun of it!
@CodeWithZi
@CodeWithZi Ай бұрын
I am glad you liked it! its def a cool ride highly recommend diving into it!
@PaintHim
@PaintHim Ай бұрын
I'm new to DSA and to leetcode, but would this be a good problem for a heap? create 5 nodes, one for each unique letter, and loop through the string. Each time you get b, a, or n, increment the respective node by 2, and each time you get l or o, increment by one. That way, when you look at the top node in the minimum heap, that letter will have the minimum number of repetitions and will decide how many times you can form "balloon" (and that's why letters b, a, and n would get incremented by 2)
@CodeWithZi
@CodeWithZi Ай бұрын
Your heap approach is quite inventive! However, it might be a bit more complex than needed for this problem. A more efficient solution would be to simply count the occurrences of the letters ‘b’, ‘a’, ‘l’, ‘o’, and ‘n’. Then, you can easily determine how many times you can form the word “balloon” based on their required quantities. This way, the solution remains clean and straightforward! Thanks for sharing your creative approach!
@talhazaryab
@talhazaryab Ай бұрын
@PaintHim Can you please share the code snippet ? I can understand your explanation but maybe your code can help. I am very curious
Reacting to Controversial Opinions of Software Engineers
9:18
Fireship
Рет қаралды 2,1 МЛН
Programming Is Cooked
9:30
ThePrimeTime
Рет қаралды 304 М.
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 26 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 23 МЛН
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 34 МЛН
you will never ask about pointers again after watching this video
8:03
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 700 М.
LeetCode: 26. Remove Duplicates from Sorted Array (Visualized)
8:54
Coding Interviews Be Like
5:31
Nicholas T.
Рет қаралды 6 МЛН
I Solved 100 LeetCode Problems
13:11
Green Code
Рет қаралды 256 М.
10 weird algorithms
9:06
Fireship
Рет қаралды 1,3 МЛН
Winning Google Kickstart Round A 2020 + Facecam
17:10
William Lin (tmwilliamlin168)
Рет қаралды 10 МЛН
I Didn’t Believe that AI is the Future of Coding. I Was Right.
6:55
Sabine Hossenfelder
Рет қаралды 594 М.
Can You Find Minimum in Stack? (LeetCode 155: Min Stack)
7:48