Amazon·Software Engineer·Online Assessment (OA)
- Given two arrays of equal length, one representing sizes and one representing costs, make all elements in the size array distinct by only incrementing values. Each increment adds the corresponding cost. Find the minimum total cost to achieve this.
“Took me a minute to realize you always want to increment the cheaper element when there's a collision, not just the one that came later.”