[
sort
merge sort
two pointers
]
BinarySearch 0079 Merging Two Sorted Lists
Problem statement
https://binarysearch.com/problems/Merging-Two-Sorted-Lists/
Solution
Just use merge sort with two pointers. Or in python if we use just sorted(a + b)
it will have linear complexity, because it uses timsort.
Complexity
It is O(m + n)
for time and space.
Code
class Solution:
def solve(self, a, b):
return sorted(a + b)