"""
Exercise 2: Merge Sorted Array (LeetCode 88)

nums1 has length m + n: the first m values are real, the last n are 0
placeholders. Merge nums2 into nums1 IN PLACE so it is sorted.
Fill from the BACK with three pointers so nothing is overwritten too early.
"""

def merge(nums1, m, nums2, n):
    # TODO
    pass


# --- self-check: do not modify below this line ---
cases = [([1, 2, 3, 0, 0, 0], 3, [2, 5, 6], 3, [1, 2, 2, 3, 5, 6]), ([1], 1, [], 0, [1]),
         ([0], 0, [1], 1, [1]), ([4, 5, 6, 0, 0, 0], 3, [1, 2, 3], 3, [1, 2, 3, 4, 5, 6])]
ok = True
for a, m, b, n, want in cases:
    arr = list(a)
    merge(arr, m, b, n)
    print(arr)
    ok = ok and arr == want
print("PASS" if ok else "FAIL")
