Facebook | SWE | Phone Screen | Aug 2020
Anonymous User
692

45 minute interview conducted over BlueJeans and CoderPad.

How do you create a thread in reddit, upvote and return the top 25 records which is sorted by the upvote ?

createThread(int threadId)
upvote(int threadId)
getThread(int threadId)

If I am using hashmap<Integer, Integer> to store threadID and its upvote count.
Can someone help me how to sort the map values such that the map is sorted descending order by upvote ?

Comments (3)