Dsa
Arrays
Medium
Frequent Number Remover
Write a function that accepts an array of integers and a frequency threshold, then removes all integers that appear more than that threshold in the array. The function should return the new filtered list.
Input:
- The first line contains an integer n (1 <= n <= 1000) — the size of the array.
- The second line contains n space-separated integers, the elements of the array.
- The third line contains an integer k (1 <= k <= 100) — the frequency threshold.
Output:
- Print the modified array maintaining the original order, or an empty line if all elements are removed.
Example:
Input:
6
1 2 3 2 4 1
2
Output:
3 4
Key concepts
arraysfrequency
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now