Has anyone seen this problem before?
Anonymous User
231

Curious if anyone has seen this problem I had in an interview before,
we are given an array of elements and we have to shrink the elements to the smallest value possible >0 while maintaining the order/arrangement where elements are unique.

e.g:

input -> [100, 50, 75, 30, 40]
output -> [5, 3, 4, 1, 2]

then it was what if they aren't unique

input -> [100, 50, 75, 30, 30]
output -> [4, 2, 3, 1, 1]

then it was what if its a 2d array where we keep order along row and column.

Comments (2)