Amazon | SDE II | Phone Interview | Reject

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-05-08Added By Anonymous
Source: Link

Company: Amazon
Role: SDE II
Interview Stage: Phone Interview
Location: unknown
Year: unknown

Original Post Content:

60 minute Interview. First 15-20 minutes were LP questions. Thought I did well.

Coding Question - Implement the following two methods in a class:
recordDeployment(packageName) - increments the frequency count of the package
getTop100Packages() - returns top 100 most frequent used packages from highest to lowest

My initial solution was to use a HashMap and sorting which is O(n log n) which I implemented. Interviewer said can we do better.

Realized it was a heap problem and proposed to use a heap which the interviewer agreed but struggled to implement it correctly with the Map before I ran out of time. Just got word that I failed.

Are there any existing LeetCode problems like this? I couldn't find one.

Comments