Apple | Phone|K-distinct ids for highest values

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-04-05Added By Anonymous
Source: Link

Company: Apple
Role: unknown
Interview Stage: Phone Screen
Location: unknown
Year: unknown

Original Post Content:

Find K distinct ids with highest values from a stream of data.
input: <id1, 50>, <id2, 30>, <id3, 20>, <id2, 40>
K = 3

Comments