Hey @Neetcode, I really enjoy your content. I watch it everyday to prepare for my interviews. I have a suggestion. Could you post content of you going into a question blind? I would really like to see your thought process when you don't know the answer. Thanks! Keep up the excellent content!
@mightyshenanigans26073 жыл бұрын
I'm prepping for my final Google round and your videos have been essential in my study. Thanks a ton!
@jackwalker29473 жыл бұрын
Best of luck bro🔥
@vour66543 жыл бұрын
You got this!
@cc-to2jn3 жыл бұрын
final round meaning host? or HC?
@mightyshenanigans26073 жыл бұрын
@@cc-to2jn onsite
@squeeps333 жыл бұрын
@@mightyshenanigans2607 I hope you get the job, you got this
@ratikdubey43752 жыл бұрын
Hey - can you make a video for Wiggle Sort 2? As always, this was super easy to understand. Thanks!
@mishkathossain29843 жыл бұрын
Man you are killing it!!!!!!!!!!!! You are one of my favorite instructor! You do, what you do best
@ngneerin3 жыл бұрын
Would love a video around your interview details from Google. What rounds were there, what complexity, what was expected, etc.
@chinesemimi3 жыл бұрын
This can be found easily if you search on google btw
@AlexN20222 жыл бұрын
interesting that if the requirement is for string < > rather than =, this approach completely breaks down
@udayptp2 жыл бұрын
It didn't work for input array [5,5,5,5,4,4,4,4]
@haitamelgharras8 ай бұрын
@@udayptp we must handle the case of a==b also
@midkay Жыл бұрын
Just a heads up, the problem solved in this video differs slightly from Leetcode's version of the problem. Leetcode's version requires values to be strictly greater or less than ("equal to" is not allowed), so the logic presented here, while solid for the problem shown in the video, breaks down when applied to Leetcode's version of the problem. One example of a test case it fails is [5,5,5,4,4,4,4] because simply swapping successive pairs of elements can't move one of the four values all the way back to the start of the array where it is needed. A solution for the Leetcode version of the problem requires different logic entirely.
@tiberiusvetus91133 жыл бұрын
Lol. Google pays well but not enough to afford Leetcode. You're hilarious.
@yonatangafri46705 ай бұрын
Thanks!!! Our teacher gave this question but with given median, perhaps it for make it easier. but now i see your solution and it is so simple!
@sibysuriyan99802 жыл бұрын
rip our boy posted this on valentines day. we need a neetgirl for our neetcode
@poptart007-b2r3 жыл бұрын
"Google pays me pretty well but not enough to afford leetcode premium of course" xD lmao cracked me up
@jackwalker29473 жыл бұрын
Man of explanation 🔥
@esorty1913 Жыл бұрын
You could have made the if statement smaller. if (not i%2 ^ nums[i] < nums[i-1]). That way you xor over the both cases and only if both are true or false it will ttigger. It is slightly different though, as the second case would also be executed with
@gasgeek4343 жыл бұрын
This man was born to explain.
@anshdholakia10603 жыл бұрын
There are so many types of sorts it's crazy. Bogo sort is my favorite tho xd
@omkarbhale442 Жыл бұрын
I believe there is a bogobogo sort too.
@Kshitij-fw7bh3 жыл бұрын
Thanks bro for ur videos.
@oluwatimilehinoyewo80102 жыл бұрын
This explanation was spot on. So grateful
@johncenakiwi3 жыл бұрын
Not enough to afford Leetcode premium 😂😂
@hammadmaya71093 жыл бұрын
Your explanations are awesome! Would you be able to do a video on 1405. Longest Happy String?
@alexwatts13753 жыл бұрын
Interviews are to understand how you think!
@blancosj3 жыл бұрын
I am following you since a year and I will have interview with google soon. Would you consider your videos to have google interview level?
@mohammedsamsuddin51262 жыл бұрын
Hey @NeetCode good works. I like your works. Could you please make a video on wiggle sort 2? thank You
@tchsu11402 жыл бұрын
Do you mind also covering wiggle sort II?
@vidhishah91543 жыл бұрын
Hi Neetcode, Thank you for the remarkable explanation. Can you please make a video on split BST ? That is premium leetcode problem and there are no explanation videos available for that problem. Thanks again for the videos and making difficult problems enjoyable.
@harry811 ай бұрын
This solution, while it seems simple, doesn't work on Leetcode for the test case [5,5,5,4,4,4,4]. This is because it is only swapping locally, and so fails to deal with cases where there are multiple repeated elements. Here, there will be a number of 4's at the end, instead of the array being [4,5,4,5,4,5,4].
@Jayavarshini_Jayakumaran2 жыл бұрын
Thanks for the video! Can you please solve Wiggle Sort 2, Leetcode. 324
@anandkumar.33073 жыл бұрын
Haha i thought this is some different problem but actually I have solved it on leetcode itself but with some different name which is not a premium problem though !!😃😃
@NeetCode3 жыл бұрын
Wait really, which one is it?
@ayoubalem8653 жыл бұрын
@@NeetCode the second version of it. Num on leetcode: 324 . instead of (gt or eq) or (ls or eq) you have (gt strictly) or (ls strictly)
@haitamelgharras8 ай бұрын
Thanks NeetCode, I tried to solve the wiggle sort 2 with the same approach but it doesnt work, even when trying to handle the equal case, I think about finding the first diff value and swap one of the repeated values with this diff value but it doesnt work
@weifang91433 жыл бұрын
[5,5,5,4,4,4,4] will make the solution invalid?
@alexanderhurst19982 жыл бұрын
Why would that solution not work? If we skip to index 3 (the first four) because we don't have to swap any of the fives, and even if we did it wouldn't matter 3 is odd which means we want it to be larger than or equal to the elements around it We find that it is less than index two so we swap those We now have [5,5,4,5,4,4,4] We move on to index 4 which is even so we want it to be less than or equal to neighbors It is so we do nothing and all the rest are 4 so we do nothing Now if we write out the list with greater than equal, less than equal signs we get 5 = 4 = 4 =4 Which is true Of course the solution [4,5,4,5,4,5,4] is more pleasing but it isn't any more correct unless you specify that you are looking strictly < and > rather than =
@badalwanjari49643 жыл бұрын
You're awesome!!!
@mynk_rjpt3 жыл бұрын
Your explanations are awesome 🔥.
@krishnachaitanya12653 жыл бұрын
Wow google cant pay 150 dollars surprised XD. Just kidding. its a penny for google software engineers or may be less than penny :)
@metarus2082 жыл бұрын
Thanks for this.
@yutianzhang6058 Жыл бұрын
Google should give employees free leetcode premium as perk~
@Axl124124 Жыл бұрын
"google pays me well but not well enough to afford leetcode premium". Come on man!
@dipeshjoshi80642 жыл бұрын
[5,5,5,4,4,4,4] this input is not Working. Since you are running loop from index 1 to n, first element is excluded. I have used different algo, which might be helpful to other. 1. run quick selection algorithm for index = n/2. (Make sure to run it inplace, since it is mentioned in question.) 2. after running quick select your median would be at proper place. So now you can assign left pointer at 0th index and right pointer on (n/2)+1 the index. 3. Now run loop over array and alternatively (i.e. index%2==1) you can swap a[left] with a[right].
@midkay Жыл бұрын
The problem isn't that the loop runs from index 1 to n and excludes the first element - it's that this entire algorithm doesn't work properly on the Leetcode version of this problem, because Leetcode's version of the problem requires values to be strictly greater or less than ("equal to" is not allowed). So simply swapping the "5"s at indexes 0 and 1, or 1 and 2, would never lead to a correct result - we need to pull over one of the "4"s later in the array. Leetcode's version of the problem requires different logic entirely.
@AkashSharma-ij4sn Жыл бұрын
If the array contains duplicate elts then?
@theantonlulz2 жыл бұрын
Yeah Lintcode also wants me to log in using my WeChat account. No thanks China 👍
@andrewknyazkov6877 Жыл бұрын
Thanks God Meta and Google don't collect their users data. China bad US good raaaaaaaaaaahhhhhhh 🦅🦅🦅🦅🦅🦅
@midkay Жыл бұрын
@@andrewknyazkov6877lollll
@udayptp2 жыл бұрын
What about if input array is [5,5,5,5,4,4,4,4] .
@SweetDarkViolet2 жыл бұрын
The array is wiggle sort itself, no reorder needed.
@shooby117 Жыл бұрын
who's here because they tryna solve Wiggle Sort 2 first lol