Facebook | SWE | Phone Screen | Aug 2020

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-08-20Added By Anonymous
Source: Link

Company: Meta (Facebook)
Role: SWE
Interview Stage: Phone Screen
Location: unknown
Year: 2020

Original Post Content:

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