Hey everyone. Check out this in-depth solution for leetcode 88.
Пікірлер: 21
@kalpitswami74752 жыл бұрын
BEST EXPLANATION TILL DATE!! THE WAY YOU EXPLAINED THE CONCEPT IT WAS SO NICE THAT I DID IT WITHOUT THE HELP OF ANY CODE SOLUTION JUST BASED ON THE LOGIC THAT YOU GAVE IN THE VIDEO.. THANKS MANN!!!!
@enriquegrageda6 ай бұрын
Had to watch it 3 times, it makes sense, thanks for making this video!
@SerafinBGG10 ай бұрын
I was struggling with understanding this problem and the solution for few days,thanks to that video i finally get it. Amazing!
@UmaSahni.9 ай бұрын
blessed with your explanation !!
@saifalikhanpathan97012 жыл бұрын
Thank you man
@utkumattaktas7994 Жыл бұрын
Hey, Andy Thank you for the explanation. I will have a question in a case where nums1 =[5,6,0,0,0] m=2 nums2=[1,2,3] n=3 . For this case "first" going "-1". What am I missing here?
@jillysong47516 ай бұрын
What if all values in first array are greater than those in second array and the first pointer goes out of range first?
@Prod3t Жыл бұрын
bless
@user-th3zc1le8h Жыл бұрын
Why not write decrement i once outside of the if statement?
@Agentsupportalpha11 ай бұрын
very bussin explanation
@Ivan_Dev8 ай бұрын
Can anyone tell me which 'drawing' software is he using plz?
@indiajackson59592 жыл бұрын
Are you still doing tutorials? I have no problem paying you for more videos…Google sent me a list of algorithms and I am in love with the way you do your conceptual work
@andygala8882 жыл бұрын
Thanks for the kind words :). I’m currently a SWE at Atlassian so taking some time off from making vids. Def recommend studying the ones that are up as they cover 90 percent of the patterns you’ll see everywhere. Best of luck on the journey!
@amorfati4559 Жыл бұрын
Is this really an easy one to solve? It is in the easy category, but I do not understand it.
@Prod3t Жыл бұрын
lol yeah I've been grinding leetcode all day and I got to this one on the easy section and it broke my brain. time for sleep.
@kubrd19212 жыл бұрын
I've done this one like: const merge = function(nums1, m, nums2, n) { nums1.length = m; nums1.push(...nums2); nums1.sort() }; It was accepted by leetcode. What do you think about this solution?
@LazyShady2 жыл бұрын
Go to Solutions, and watch the video in the beginning. They will explain why .sort is less optimal
@feeaven Жыл бұрын
Also i think this solution use too many built in functions from js
@codehunter4072 Жыл бұрын
Yes you solved 😂, but the purpose of leetcode are to train your algorithm and data structure, better to do manually 😅
@arthurmastropietro526111 ай бұрын
i think this solution is only valid, for some reason, in JavaScript. Other languages like Go will give me index out of range if i have inputs like this: nums1 = [2,0], m = 1, nums2[1], n = 1 in Go i would have to check if first >= 0 before assigning or comparing .Javascript accepts nums1[-1] returns undefined and, by luck maybe, goes to the else clause.
@Michael-kp4bd2 жыл бұрын
I think the time complexity of O(m+n) you calculated is NOT reducible to O(n). They’re independent arrays: If m is huge, it’s significant. If n is huge, it’s significant. Worst case, you walk through each element of m and n. I think that happens any time n[0] < m[0] because you don’t break out of the “while” condition until n[0] gets sorted into m[0]. In other words, you have to update “i” exactly m+n times. I think interviewers like when you recognize these things and don’t drop constants just because you’re used to, say, O(2n) reducing to O(n). So I think true time complexity is O(m+n). Definitely feel free to correct me if I’m wrong!