Given two unsorted integer arrays a and b, where a has enough placeholder positions at the end to hold all elements of b, merge b into a and sort the final array in ascending order. Example: a = [5, 1, 3, 0, 0, 0], b = [6, 2, 4] -> a = [1, 2, 3, 4, 5, 6].
Asked in the coding stage. The result must be stored in a; both arrays are unsorted, and no explicit O(1) space requirement is imposed.
Function: def merge_and_sort(a, b):. The first len(a) - len(b) elements of a are data, and its remaining positions are placeholders. Return the modified a.
def merge_and_sort(a, b):