MERGE K SORTED LISTS | LEETCODE 23 | PYTHON OPTIMAL SOLUTIO

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

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 14
@ahsanshafiqchaudhry
@ahsanshafiqchaudhry 7 ай бұрын
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
@muskanmall4401
@muskanmall4401 Ай бұрын
thanks for explaining the logic for the indices to skip, and explaining the code so well!! Appreciate it !
@ajvercueil8111
@ajvercueil8111 7 ай бұрын
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 8 ай бұрын
Thanks a lot for a clear and concise optimal solution. I love how straight to the point you are!
@sharduldave8286
@sharduldave8286 9 ай бұрын
Thank you for your video, it really helped me understand the problem and the solution for it
@sonicspider49
@sonicspider49 3 ай бұрын
Nice video!
@Prenevyspam
@Prenevyspam Ай бұрын
Can this be solved using heaps? Is that the expected solution?
@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! :)
IMPLEMENT TRIE | LEETCODE 208 | PYTHON
15:53
Cracking FAANG
Рет қаралды 1,3 М.
Merge K Sorted Lists - Leetcode 23 - Python
10:34
NeetCode
Рет қаралды 215 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
modulus #26
22:36
destiny2iit
Рет қаралды 3
L25. Merge K Sorted Lists | Multiple Approaches
30:02
take U forward
Рет қаралды 57 М.
BEST MEETING POINT | LEETCODE 296 | PYTHON OPTIMAL SOLUTION
18:06
Cracking FAANG
Рет қаралды 2,7 М.
Fast and Slow Pointers in 6 Minutes | LeetCode Pattern
6:09
AlgoMasterIO
Рет қаралды 3,7 М.
Merge K Sorted Linked Lists - Leetcode 23 - Heaps (Python)
10:07
HashMaps & Dictionaries, Explained Simply
22:44
Nic Barker
Рет қаралды 8 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 193 М.
Support each other🤝
00:31
ISSEI / いっせい
Рет қаралды 81 МЛН