Merge Two Sorted Lists | Live Coding with Explanation | Leetcode #21

preview_player
Показать описание
To support us you can donate

Check out our other popular playlists:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!!

Questions you might like:

Struggling in a question??

Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

Thanks I think this is a better explanation than the popular videos, code is much more straight forward/closer to intuition

victorhaynes
Автор

So clean and the explanation is so clear!

kitkatrobot
Автор

Cleanest explanation/implementation of this problem hands down.

jrpg
Автор

It was good explanation tq for creating this video

kartikbhat
Автор

You are too good.
You will go far just keep putting efforts.
Thanks a lot really a lot :)

spardha-yug
Автор

Hi ! My question is only about this last part :
if(l1!=null){
dummy.next=l1;
}
if(l2!=null){
dummy.next=l2;
}

Doesn't this block of code logically take care of the numbers which haven't been added in the while loop ?
For example our lists are : list1=[1, 2, 4] list2=[1, 3, 4, 7, 8, 9]
So the while loop will form the list=[1, 1, 2, 3, 4, 4] and the rest will be added by the block :
if(l2!=null){
dummy.next=l2;
}
My question is : doesn't that block add only one node ? Because it would be able to add multiple nodes . It would be in my opinon something like this :
while(l2!=null){
dummy.next=l2;
l2=l2.next;
}
What is the logic mistake that I made ? Thank you in advance!

sakkamouid
Автор

is the time & space complexity is correct ? T=O(n), S=O(1)

apurvtripathi
Автор

At starting dummy's next is null after the while loop how dummy's next becomes some address

lavanyam
Автор

I am not clear that why can't we use dummy directly instead of assigning it to the curr node?

shouryareddy
Автор

THIS IS A TWO POINTER APPROACH ? IS IT?

adi-ai-
Автор

tc: o(l1 + l2) && sc : o(l1 + l2) kindly optimize it mam

adityakaldate
Автор

that was the slowest possible solution runtime wise LMFAO

nx_
Автор

madam, I love u soo much now I got the idea🥺😍 TQSM.

balavardhanreddy