FACILIO On-Campus OA (2024) | Problem Count Elements With Maximum Frequency
Question · Posted Jun 2026
Problem Statement Given an integer array nums, return the total number of elements that have the highest frequency. If multiple numbers share the maximum frequency, count all their occurrences. Example 1 Input nums = [1,2,2,3,1,4] Output 4 Explanation 1 appears 2 times 2 appears 2 times 3 appears 1 time 4 appears 1 time Maximum frequency = 2 Elements with maximum frequency: 1 → 2 occurrences 2 → 2 occurrences Total: 2 + 2 = 4
The full answer & interview discussion are available to premium members.
Log in Create a free account