We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Merge two sorted linked lists
- Discussions
Merge two sorted linked lists
Merge two sorted linked lists
Sort by
recency
|
229 Discussions
|
Please Login in order to post a comment
C# solution after consulting geeksforgeeks when I got stuck
C#, test case two fails. It seems there is 1 test case, for which the first linked list is 8 ints. The next set of ints for list 2 are unordered it seems. All of my other test cases pass.
the explanation part with sample had mistake ,
Explanation
The first linked list is: 1 -> 3 -> 7 ->NULL The second linked list is: 3->4->NULL Hence, the merged linked list is: 1->2->3->3->4->NULL where is the 7 gone from list 1 ?
Bit hacky but...
Not very clean, but non-recursive solution that uses given class in js: