What is the time complexity of merging two sorted arrays?
What is the time complexity of merging two sorted arrays?
Approach: Two-pointer approach analysis.
O(n + m), where n and m are the lengths of the two arrays. Each element is visited exactly once.
Follow-up: Can you do it in-place if one array has enough buffer?
Key concepts: linear time, pointers.