Search
⌘K

Leetcode 1331. Rank Transform of an Array

Replace each number by its rank among the distinct values (smallest value → rank 1, equal values share the same rank), effectively performing a coordinate-compression mapping from value to its sorted position. This yields an array of ranks preserving relative order while using ranks as small as possible.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.