Algorithm · Akuna Capital · Medium
Requirements You are given two integer arrays, a and b, both of length n. You may perform no more than k swaps, where each swap exchanges one entry from a with one entry from b. Determine the largest possible count of distinct values in a. Examples Exchange a[1] with b[0], then exchange a[3] with b[2]. This produces a = [5, 8, 6, 9, 7], containing 5 unique values. Answer: 5.
Checking your access…