Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ListNode* merge(ListNode* p, ListNode* q) {
- if(!p) return q;
- if(!q) return p;
- if(p->val < q->val)
- {
- p->next = merge(p->next, q);
- return p;
- }
- else
- {
- q->next = merge(p, q->next);
- return q;
- }
- }
Add Comment
Please, Sign In to add comment