I am stuck to understand the solution to the problem https://www.codechef.com/problems/MERGEBS

Please help with an explanation/approach/solution with explanation for this problem