This question evaluates proficiency in array manipulation, in-place algorithms, and reasoning about time and space complexity when merging sorted sequences.

You are given two nondecreasing arrays A and B, where A has enough trailing empty slots to hold all elements of B. Merge B into A in-place so that A remains sorted. Describe and implement an algorithm that runs in O(m+n) time and O(