No video

LEETCODE 88 (JAVASCRIPT) | MERGE SORTED ARRAY

  Рет қаралды 11,537

Andy Gala

Andy Gala

3 жыл бұрын

Hey everyone. Check out this in-depth solution for leetcode 88.

Пікірлер: 21
@kalpitswami7475
@kalpitswami7475 2 жыл бұрын
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!!!!
@enriquegrageda
@enriquegrageda 6 ай бұрын
Had to watch it 3 times, it makes sense, thanks for making this video!
@SerafinBGG
@SerafinBGG 10 ай бұрын
I was struggling with understanding this problem and the solution for few days,thanks to that video i finally get it. Amazing!
@UmaSahni.
@UmaSahni. 9 ай бұрын
blessed with your explanation !!
@saifalikhanpathan9701
@saifalikhanpathan9701 2 жыл бұрын
Thank you man
@utkumattaktas7994
@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?
@jillysong4751
@jillysong4751 6 ай бұрын
What if all values in first array are greater than those in second array and the first pointer goes out of range first?
@Prod3t
@Prod3t Жыл бұрын
bless
@user-th3zc1le8h
@user-th3zc1le8h Жыл бұрын
Why not write decrement i once outside of the if statement?
@Agentsupportalpha
@Agentsupportalpha 11 ай бұрын
very bussin explanation
@Ivan_Dev
@Ivan_Dev 8 ай бұрын
Can anyone tell me which 'drawing' software is he using plz?
@indiajackson5959
@indiajackson5959 2 жыл бұрын
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
@andygala888
@andygala888 2 жыл бұрын
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
@amorfati4559 Жыл бұрын
Is this really an easy one to solve? It is in the easy category, but I do not understand it.
@Prod3t
@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.
@kubrd1921
@kubrd1921 2 жыл бұрын
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?
@LazyShady
@LazyShady 2 жыл бұрын
Go to Solutions, and watch the video in the beginning. They will explain why .sort is less optimal
@feeaven
@feeaven Жыл бұрын
Also i think this solution use too many built in functions from js
@codehunter4072
@codehunter4072 Жыл бұрын
Yes you solved 😂, but the purpose of leetcode are to train your algorithm and data structure, better to do manually 😅
@arthurmastropietro5261
@arthurmastropietro5261 11 ай бұрын
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-kp4bd
@Michael-kp4bd 2 жыл бұрын
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!
LEETCODE 33 (JAVASCRIPT) | SEARCH IN ROTATED SORTED ARRAY I
15:43
LEETCODE 442 (JAVASCRIPT) | FIND ALL DUPLICATES IN AN ARRAY
12:57
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 194 МЛН
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 12 МЛН
Javascript Freecodecamp Algorithm #34: Implement Merge Sort
18:29
LEETCODE 21 (JAVASCRIPT) | MERGE TWO SORTED LISTS
14:29
Andy Gala
Рет қаралды 15 М.
LEETCODE 22 (JAVASCRIPT) | GENERATE PARENTHESES
19:38
Andy Gala
Рет қаралды 4,4 М.
JavaScript Algorithms - 27 - Merge Sort Solution
7:20
Codevolution
Рет қаралды 37 М.
LEETCODE 56 (JAVASCRIPT) | MERGE INTERVALS
13:43
Andy Gala
Рет қаралды 4,3 М.
LeetCode 27 - Remove Element (JavaScript)
5:33
Hayk Simonyan
Рет қаралды 1,3 М.
Medium Google Coding Interview With Ben Awad
51:27
Clément Mihailescu
Рет қаралды 1,2 МЛН
I solved 541 Leetcode problems. But you need only 150.
7:42
Sahil & Sarra
Рет қаралды 2,3 МЛН
What is a Monad? - Computerphile
21:50
Computerphile
Рет қаралды 598 М.
Spot The Fake Animal For $10,000
00:40
MrBeast
Рет қаралды 194 МЛН