Minimum Cost with different Size
Anonymous User
546

We are given two arrays
cost = [1,2,3,4,5]
size = [1,1,2,3,3]

0<=cost[i]<=10^9
0<=size[i]<=10^4

We need to find minimum cost such that all sizes are different.
We can increase size of a element one time for cost[i] .

I solved it by: sort by cost then use a set to find next available size but asked to faced TLE.

Comments (2)