You are given two sorted arrays A and B of sizes m and n respectively. Write a program to merge them in such a way that the resultant array is sorted too.
- The size of the resultant array should be n+m.
- You are expected to solve this question in O(n+m) time.
- Your final array should be the first array i.e. array A.
Input: A = [3,9,10,18,23], B = [5,12,15,20,21,25] m = 5, n = 6 Output: [3,5,9,10,12,15,18,20,21,23,25]
Input: A = [2,5,9], B = [12,19,23], m = 3, n = 3 Output: [2,5,9,12,19,23]
Input: A = [2,20], B = [5,9,14,16,19], m = 2, n = 5 Output: [2,5,9,14,16,19,20]