Тёмный

MERGE K SORTED LISTS | LEETCODE 23 | PYTHON OPTIMAL SOLUTIO 

Cracking FAANG
Подписаться 17 тыс.
Просмотров 2,7 тыс.
50% 1

Опубликовано:

 

16 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 11   
@ahsanshafiqchaudhry
@ahsanshafiqchaudhry 3 месяца назад
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 Год назад
Never seen such crisp and simple approach to solve this problem in any other channel. So addicted to problem solving method. Thanks
@crackfaang
@crackfaang Год назад
Thanks for the kind words and welcome to the channel
@dnm9931
@dnm9931 4 месяца назад
Thanks a lot for a clear and concise optimal solution. I love how straight to the point you are!
@ajvercueil8111
@ajvercueil8111 4 месяца назад
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.
@sharduldave8286
@sharduldave8286 6 месяцев назад
Thank you for your video, it really helped me understand the problem and the solution for it
@YT.Nikolay
@YT.Nikolay Год назад
It's probably was my first hard problem I managed to solve myself :) 🥳🥳🥳
@crackfaang
@crackfaang Год назад
Amazing! Progress feels great doesn't it?
@YT.Nikolay
@YT.Nikolay Год назад
@@crackfaang it does feel sooooo good! :)
Далее
9월 15일 💙
1:23:23
Просмотров 1,2 млн
Mini bag sealer
00:58
Просмотров 4,2 млн
Merge K Sorted Lists - Divide and Conquer Approach
12:01
How Fast can Python Parse 1 Billion Rows of Data?
16:31