Shouldn't it get stuck in an infinite loop if 1 is in the list of numbers?
@osamahussam4351Күн бұрын
The first viewer ever .. actually I'm struggling now in this question, but I feel like it's easy, and all the ppl in the discussion section said it must be marked as easy .. and I spent like 50 min, and I can't solve that, actually it's frustrated! I'm new in problem solving and I solved like 80 problems, can u give me any advice please ?
@ThinkOutsideTheBox12345Күн бұрын
I would say the key is practice. Try to go step by step from the easier to harder algorithms and common patterns to adapt to the problem difficulty. If you can’t solve mediums like this problem, try solving easies first, and work your way up from there. Also, when solving problems, try to ask yourself questions like, which algorithm should I use to solve this, or what patterns do I notice in the problem. Also, if you cant solve a problem within 40-50 mins, try googling solutions or watching vidoes and then ask yourself, why and how does this work. But overall, make sure you are familiar and are comfortable with Data Structures and Algorithms, look for key patterns and try to analyze how you would solve a problem. Try to think what tools you might need to solve the problem, how you would approach the problem, and things like that. Your initial thoughts dont have to be the most optimal solution, just try to understand and grasp problems, and how you would think to approach it, I recommend starting with brute force solutions first when needed. Also, try asking ChatGpt to give you practice problems and logic problems to improve problem solving skills, and start easy and work your way up to harder problems. Also, I recommend AOPS as well if you want to try to improve problem solving skills!
@osamahussam4351Күн бұрын
@ThinkOutsideTheBox12345 actually very helpful, thanks a lot ❤❤
@ThinkOutsideTheBox12345Күн бұрын
@ No worries, glad I could help!
@John-g1p2xКүн бұрын
Awesome!
@ThinkOutsideTheBox12345Күн бұрын
Thank you! Cheers!
@John-g1p2x8 күн бұрын
Nice!
@John-g1p2x9 күн бұрын
Nice!
@ThinkOutsideTheBox1234521 күн бұрын
Sorry if I talked too fast, try slowing down the video to 0.75x speed when needed!
@ThinkOutsideTheBox1234524 күн бұрын
Hope you guys enjoyed and learned something new! Feel free to add any questions in the comment section down below! This was honestly a very hard problem, but I hope you guys liked it!😅
@John-g1p2x24 күн бұрын
nice
@ThinkOutsideTheBox1234525 күн бұрын
Hope you guys enjoy this daily leetcode Challenge!
@John-g1p2x26 күн бұрын
nice bro
@imeldamogi27 күн бұрын
yes, plz
@r5pmet43527 күн бұрын
but this makes us to check all the list even if we already know the majority element. So isnt it better to use a hashmap since there are only 2 elements in our map it wont take space?
@ThinkOutsideTheBox1234527 күн бұрын
I understand where you're coming from, but the hashmap would take extra space and cause the space-time complexity to be O(N). The one-pass solution I showed would be taking only O(1) constant space and still have a runtime complexity of of linear time, making it the more optimal solution. Although the hashmap solution is a lot easier to code, the voting algorithm would be more optimal because of that constant extra space.
@thetornadodragon611429 күн бұрын
Very good explanation!
@spektral05Ай бұрын
very cool!
@John-g1p2xАй бұрын
Great job!
@spidersddc3051Ай бұрын
Large
@krishkelageri8865Ай бұрын
Nice Name!
@ThinkOutsideTheBox12345Ай бұрын
Thanks!
@John-g1p2xАй бұрын
Awesome!
@krishkelageri8865Ай бұрын
subscribe button smashed 👍
@John-g1p2xАй бұрын
Nice!
@krishkelageri8865Ай бұрын
Nice!
@JustAnotherHuman100Ай бұрын
keep up the good work akhil kulkarni !!
@John-g1p2xАй бұрын
Cool!
@HellohihihihihihihiАй бұрын
I was struggling on this one! Thank you!
@ThinkOutsideTheBox1234522 күн бұрын
Happy to help!
@HellohihihihihihihiАй бұрын
Don't worry, you talked perfectly!
@HellohihihihihihihiАй бұрын
Thank you!
@HellohihihihihihihiАй бұрын
you explained it very well!
@HellohihihihihihihiАй бұрын
good job!
@MyKneeHurtsАй бұрын
did you record the audio on a potato by any chance? even a smartphone from 2010 would have a better mic than the shit youre recording with, jesus
@John-g1p2xАй бұрын
Nice!
@HellohihihihihihihiАй бұрын
Another great video!
@Beater-w9nАй бұрын
I was struggling on this one! Thank you!
@AaravlikespianoАй бұрын
Thank You!
@krishkelageri8865Ай бұрын
this is one of your best videos! Good job!
@John-g1p2xАй бұрын
Awesome!
@AaravlikespianoАй бұрын
good job!
@John-g1p2xАй бұрын
Cool!
@John-g1p2xАй бұрын
Nice!
@krishkelageri8865Ай бұрын
Another great video!
@AaravlikespianoАй бұрын
100+ views! Good job!
@John-g1p2xАй бұрын
Nice!
@AaravlikespianoАй бұрын
thank you
@HellohihihihihihihiАй бұрын
I really enjoyed this video!
@AaravlikespianoАй бұрын
me too!
@HellohihihihihihihiАй бұрын
I have also started leetcode because of you!
@spektral05Ай бұрын
this is such a banger
@HellohihihihihihihiАй бұрын
yes, it really is
@lightninghawkgaming6049Ай бұрын
Wow, thank you. This really aided me in my quest for programming mastery.