MERGE K SORTED LISTS | LEETCODE 23 | PYTHON OPTIMAL SOLUTIO

  Рет қаралды 3,361

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 12
@ahsanshafiqchaudhry
@ahsanshafiqchaudhry 6 ай бұрын
Thanks! Great Explanation. Just one observation: Recursive calls always consume (stack) space, I think if you replace the merge(self, l1, l2) with iterative version, that would be actually constant space.
@jayeshbhoi6844
@jayeshbhoi6844 2 жыл бұрын
Never seen such crisp and simple approach to solve this problem in any other channel. So addicted to problem solving method. Thanks
@crackfaang
@crackfaang 2 жыл бұрын
Thanks for the kind words and welcome to the channel
@ajvercueil8111
@ajvercueil8111 6 ай бұрын
Thanks for another great explanation, you always make complex solutions and approaches so easy to understand. Quick heads up, the merge function you defined is recursive, so your space complexity is O(n + m) due to recursive stack frames. The first call to merge does not return until the ends of both l1 and l2 have been reached, so n+m stack frames consume O(n+m) space. To maintain O(1) space complexity, we should iteratively merge the linked lists.
@dnm9931
@dnm9931 7 ай бұрын
Thanks a lot for a clear and concise optimal solution. I love how straight to the point you are!
@sharduldave8286
@sharduldave8286 8 ай бұрын
Thank you for your video, it really helped me understand the problem and the solution for it
@sonicspider49
@sonicspider49 Ай бұрын
Nice video!
@YT.Nikolay
@YT.Nikolay 2 жыл бұрын
It's probably was my first hard problem I managed to solve myself :) 🥳🥳🥳
@crackfaang
@crackfaang 2 жыл бұрын
Amazing! Progress feels great doesn't it?
@YT.Nikolay
@YT.Nikolay 2 жыл бұрын
@@crackfaang it does feel sooooo good! :)
3-Sum | Leetcode 15 | PYTHON POINTER SOLUTION
19:19
Cracking FAANG
Рет қаралды 1,1 М.
Merge K Sorted Linked Lists - Leetcode 23 - Heaps (Python)
10:07
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 211 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3 МЛН
Merge K Sorted Lists - Leetcode 23 - Python
10:34
NeetCode
Рет қаралды 207 М.
BEST MEETING POINT | LEETCODE 296 | PYTHON OPTIMAL SOLUTION
18:06
Cracking FAANG
Рет қаралды 2,4 М.
L25. Merge K Sorted Lists | Multiple Approaches
30:02
take U forward
Рет қаралды 52 М.
EXCLUSIVE TIME OF FUNCTIONS | LEETCODE 636 | PYTHON SOLUTION
15:42
Cracking FAANG
Рет қаралды 6 М.
INTERVAL LIST INTERSECTIONS | LEETCODE 986 | PYTHON TWO-POINTER SOLUTION
12:16
RANDOM PICK INDEX | LEETCODE # 398 | PYTHON RESERVOIR SAMPLING
14:56
Merge k Sorted Lists | Live Coding with Explanation | Leetcode - 23
8:08
Algorithms Made Easy
Рет қаралды 14 М.
Merge Two Sorted Lists - Leetcode 21 - Linked Lists (Python)
9:41
MINIMUM WINDOW SUBSTRING | LEETCODE # 76 | PYTHON SOLUTION
28:08
Cracking FAANG
Рет қаралды 3 М.