The Maximum Array
CodeChefOpen on judge ↗
You are given two arrays ‘a’ and ‘b’ both consisting of n positive (greater than zero) integers. You are also given an integer k. In one move, you can choose two indices i and j (1 ≤ j ≤ n) and swap ai and bj (i.e. element with index ‘i’ in ‘a’ becomes element with index ‘j’ in b and vice versa). Your task is to find the maximum possible sum you can obtain in the array a if you can do no more than
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start