Merge Two Sorted Lists - Leetcode 21 - Linked Lists (Python)

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

Greg Hogg

Greg Hogg

Күн бұрын

Пікірлер: 29
@GregHogg
@GregHogg 4 ай бұрын
Master Data Structures & Algorithms For FREE at AlgoMap.io!
@BilalTroll
@BilalTroll 3 ай бұрын
This is the only explanation that makes sense, I prefer this over the neetcode video.
@GregHogg
@GregHogg 3 ай бұрын
Glad to hear it!!
@Fam-m4i
@Fam-m4i 3 ай бұрын
Neetcode sucks man . I get bored watching his videos
@akshatsingh9830
@akshatsingh9830 6 күн бұрын
a issue which might be either me or bcom someone elses problem in ur c++ solution : correc the dummy node initialization ListNode*dummy = new ListNode(0) , this works everytime and doesnt produces error
@yvettcodes
@yvettcodes Ай бұрын
your videos are always so clear and helpful! thank you!
@itsurabhi506
@itsurabhi506 4 ай бұрын
loved the explanation i've watched other videos where they created a new list and just added the values in sorted order changing the pointers is what was asked here Thank you very much
@GregHogg
@GregHogg 4 ай бұрын
No problem!
@darshanamohanan6101
@darshanamohanan6101 3 ай бұрын
Thank you so much.This was really easy to understand.
@AmanjotSingh-rj7ox
@AmanjotSingh-rj7ox 3 ай бұрын
thanks greg, i was not able to understand how its O(1) space until i saw your whiteboarding
@abhishekgeorge8626
@abhishekgeorge8626 2 ай бұрын
can u explain me who it is o(1) im also confused
@creatorsstudio9
@creatorsstudio9 3 ай бұрын
can't thank you enough gregg !!!!
@christianjt7018
@christianjt7018 3 ай бұрын
Very clean solution, thanks a lot!
@GregHogg
@GregHogg 3 ай бұрын
Thank you!
@Everafterbreak_
@Everafterbreak_ 3 ай бұрын
really good explanation bro!
@pound9799
@pound9799 22 күн бұрын
HOW IS THAT AN EASY QUESTION
@prathameshpatankar1864
@prathameshpatankar1864 7 ай бұрын
You made it easy to understand. Nicely explained.
@GregHogg
@GregHogg 7 ай бұрын
Glad to hear it!
@软件实验室
@软件实验室 6 ай бұрын
Really clear explanation, thank you so much! keep up the good work
@GregHogg
@GregHogg 6 ай бұрын
Very glad to hear it! Thanks so much :)
@samfromuk796
@samfromuk796 5 ай бұрын
Love the explanation
@mroafish
@mroafish Ай бұрын
What would a solution look like if we were asked to create a new node and then add it to our linked list? I am trying to implement that but i am struggling
@chuckyyys
@chuckyyys Ай бұрын
def mergeTwoLists(self, list1, list2): cur1, cur2 = list1, list2 # dummy node cur3 = l3 = ListNode() while(cur1 and cur2): # link current (of result list) to the new node cur3.next = ListNode() # move current to the new node cur3 = cur3.next # compare values if (cur1.val
@ECO720Hunter
@ECO720Hunter 6 ай бұрын
Thank you for the explanation. Very clear and neat. I'm a python-virgin and have two trivial questions 1. how do you test the code? I've written a code and test it on leetcode and it's fine but when running on python, I can't test it and got error! 2. Why do you insert # behind ListNode class? if it is excluded from the code how does the remaining part of the code work?
@GregHogg
@GregHogg 6 ай бұрын
Good question. Basically leetcode puts the class in a hashtag for readability. But the class is actually necessary. It's leetcode being weird
@stringjourney
@stringjourney 6 ай бұрын
Crisp and clear
@GregHogg
@GregHogg 6 ай бұрын
Super glad to hear it!!
@tayyabkhan1139
@tayyabkhan1139 2 ай бұрын
i am getting tle error
@davea136
@davea136 3 ай бұрын
MergeSort, essentially.
Linked List Cycle - Leetcode 141 - Linked Lists (Python)
7:47
Data Analysis with Python for Excel Users - Full Course
3:57:46
freeCodeCamp.org
Рет қаралды 3,3 МЛН
Thank you Santa
00:13
Nadir Show
Рет қаралды 36 МЛН
БУ, ИСПУГАЛСЯ?? #shorts
00:22
Паша Осадчий
Рет қаралды 3 МЛН
Valid Parentheses - Stack - Leetcode 20 - Python
10:43
NeetCode
Рет қаралды 419 М.
Reverse Linked List - Leetcode 206 - Linked Lists (Python)
8:02
Merge Two Sorted Lists | Leet code 21 | Theory explained + Python code
13:27
Diameter of Binary Tree - Leetcode 543 - Trees (Python)
11:16
Top K Frequent Elements - Leetcode 347 - Heaps (Python)
14:08
Greg Hogg
Рет қаралды 11 М.
10 Crazy Python Operators That I Rarely Use
11:37
Indently
Рет қаралды 43 М.
L23. Merge two sorted Linked Lists
18:55
take U forward
Рет қаралды 72 М.
Number of Islands - Leetcode 200 - Graphs (Python)
11:01
Greg Hogg
Рет қаралды 10 М.