Quick Overview

Return the k most frequent distinct integers with deterministic ordering for frequency ties. Combine a frequency map with buckets populated in first-occurrence order to reach O(n) time without comparison sorting.

Return the Top K Most Frequent Elements

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Overview: Return the k most frequent distinct integers with deterministic ordering for frequency ties. Combine a frequency map with buckets populated in first-occurrence order to reach O(n) time without comparison sorting.

Read the full Amazon Software Engineer interview experience this question came from

Loading…