It's wild how good this format is for this content
Shorts are great. Keep going 🎉
We need more shorts .. saves hours
Like merge sort
Is it the same logic behind merge?
In Common Lisp (sort (append list1 list2) #’<)
Don't call me a dummy!
In the first line of the solution, why do we need dummy instead of just node = ListNode( ) and return node?
Why all that? I think we can just merge the arrays using a spread operator and then sort it. Done
Actually intuitive solution: convert both to array, sort, convert back to linked list.
Cool thanks for posting
can we use a map in c++?
Why do we need dummy and why return dummy.next?
but this solution is not optimal 38ms!!??
I hate python's implicit conversion. How do you assess a freaking list as true or false. Just cannot mentally grasp this
Yes. This is merge sort algo. Next level would be to sort it in-place, meaning without creating a new array or linked list, instead, sort it in one of the list by rearranging.
I don’t understand this, what the first line with dummy does? Are we creating extra linkedlist to make the sorted LL?
This code only works if both lists are of equal length. In case if one list is longer than the other, we’ll need another loop to add all remaining nodes from the longer list
Pointers!
@jnayehsirine6222