MERGE K SORTED LISTS | LEETCODE 23 | PYTHON OPTIMAL SOLUTIO

  Рет қаралды 4,163

Cracking FAANG

Cracking FAANG

Күн бұрын

Пікірлер: 14
@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
@ahsanshafiqchaudhry
@ahsanshafiqchaudhry 8 ай бұрын
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.
@muskanmall4401
@muskanmall4401 2 ай бұрын
thanks for explaining the logic for the indices to skip, and explaining the code so well!! Appreciate it !
@ajvercueil8111
@ajvercueil8111 8 ай бұрын
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 9 ай бұрын
Thanks a lot for a clear and concise optimal solution. I love how straight to the point you are!
@sharduldave8286
@sharduldave8286 10 ай бұрын
Thank you for your video, it really helped me understand the problem and the solution for it
@sonicspider49
@sonicspider49 3 ай бұрын
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! :)
@Prenevyspam
@Prenevyspam 2 ай бұрын
Can this be solved using heaps? Is that the expected solution?
BEST MEETING POINT | LEETCODE 296 | PYTHON OPTIMAL SOLUTION
18:06
Cracking FAANG
Рет қаралды 2,8 М.
Merge K Sorted Lists - Leetcode 23 - Python
10:34
NeetCode
Рет қаралды 220 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН
L25. Merge K Sorted Lists | Multiple Approaches
30:02
take U forward
Рет қаралды 61 М.
Merge K Sorted Linked Lists - Leetcode 23 - Heaps (Python)
10:07
INTERVAL LIST INTERSECTIONS | LEETCODE 986 | PYTHON TWO-POINTER SOLUTION
12:16
INSERT INTO CIRCULAR LINKED LIST | LEETCODE # 708 | PYTHON SOLUTION
15:25
AI Is Making You An Illiterate Programmer
27:22
ThePrimeTime
Рет қаралды 253 М.
LRU Cache - Twitch Interview Question - Leetcode 146
17:49
NeetCode
Рет қаралды 327 М.
To Brawl AND BEYOND!
00:51
Brawl Stars
Рет қаралды 17 МЛН