#mergetwolists
Explore tagged Tumblr posts
Photo
![Tumblr media](https://64.media.tumblr.com/7700a8339f058b3cca6ac58039e445ce/053bda2492a0b15f-13/s540x810/f3c7bfc12ab288892fa9c217f20edcaf86f8b374.jpg)
Leetcode - merge Two Lists using recursive #arifinfrds #leetcode #leetcodesolution #datastructuresandalgorithms #programmer #softwarengineer #swiftprogramming #softwaredeveloper #linkedlist #mergetwolists #recursive https://www.instagram.com/p/CnTqQ17y-jN/?igshid=NGJjMDIxMWI=
#arifinfrds#leetcode#leetcodesolution#datastructuresandalgorithms#programmer#softwarengineer#swiftprogramming#softwaredeveloper#linkedlist#mergetwolists#recursive
1 note
·
View note
Text
Leetcode Problem#21. Merge Two Sorted Lists
Leetcode Problem#21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.
Example:
Input: 1->2->4, 1->3->4 Output: 1->1->2->3->4->4
Solution:
class Solution { public: ListNode *mergeTwoLists(ListNode *l1, ListNode *l2) { ListNode dummy{0}; auto curr = &dummy; while (l1 && l2) { if (l1->val val)…
View On WordPress
0 notes