Sort List (JS) Leetcode

preview_player
Показать описание
This demonstrates how to solve #148 medium level problem on Leetcode written in Javascript.

Рекомендации по теме
Комментарии
Автор

This is awesome. Thank you for the perfect reference to learning how to solve this problem.

joechacon
Автор

enjoying the videos...thank you for the help on understanding these problems, how long did it take you to get this comfortable with these linked list problems

seth_king_codes
Автор

i am having a tough time understanding linked lists, can you explain me why is the result itself passed as the "next" parameter to the new Node, how does that work?

imransehic
Автор

Any reason you create a new Node class instead of using the ListNode provided by the problem?

codingispower
Автор

Runtime complexity of JavaScript's arr.sort is O(nlogn) in average case so your solution is not O(n) time. Nor is your space complexity O(1), because you're creating not only temp integer array but also new nodes from the array. Your space complexity is 2n so O(n). I almost never comment on videos but you were wrong on all fronts in terms of complexity analysis, and hopefully my comment prevents any clueless person from getting misinformed by this video.

lucretius
join shbcf.ru