Google | Phone Screen | Get Rank
Anonymous User
2843

Design Below APIs, getRank/getName might be called interleave with insert(), name and score are guarantee no duplicated.

// rank = 0 is highest , rank = 1 is second highest and so on
insert(name, score)
getRank(name) 
getName(rank)

Follow up :
What if score might have duplication, in that case earlier insertion name has higher rank

Comments (8)