Merge Two Sorted Lists
Problem: Given two sorted lists, merge them into one.
// 7 ms (Beats 90%)
// 11.15 MB (Beats 32%)
# 54 ms (Beats 96%)
# 17.43 MB (Beats 54%)
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def mergeTwoLists(self, list1: Optional[ListNode], list2: Optional[ListNode]) -> Optional[ListNode]: