DEV Community

Haripriya V
Haripriya V

Posted on

ASSIGNMENT 15

  1. Merge Two Sorted Lists

CODE:

class Solution:
def mergeTwoLists(self, a, b):
if a and b:
if a.val > b.val:
a, b = b, a
a.next = self.mergeTwoLists(a.next, b)
return a or b

Top comments (0)