Problem Overview
The "Make Array Unique with Minimum Cost" problem, often asked in Adobe interviews, involves transforming an array of numbers into unique values by incrementing duplicates, where each increment costs the associated element's cost value. Tags include Array, Greedy, Sorting, and Priority Queue, emphasizing efficient handling of duplicates via greedy strategies.[1]
You are given two arrays: nums (or sizes) of length n containing integers, and cost (or costs) of the same length, where cost[i] is the cost to increment nums[i] by 1. The goal is to make all elements in nums unique by incrementing some elements any number of times (you can only increment, not decrement), minimizing the total cost. Each increment of nums[i] by 1 adds cost[i] to the total cost.[1]
nums = [3, 7, 9, 7, 8], costs = [5, 2, 5, 7, 5]4 (e.g., increment the second 7 to 10 costs 7, but greedy approaches find minimal via priority queue).[1]No additional full examples were compiled in sources, but discussions show processing duplicates like changing one 7 to a unique value (e.g., 10) at minimal cost.[1]
1 <= n <= 10^5 (array length)1 <= nums[i] <= 10^91 <= cost[i] <= 10^4nums and cost have equal length n.[1]