Ctrl K

Most Frequent Tags in Total

Easy
You are given a list tags of tag numbers attached to photos. The frequency of a tag is how many times it appears in the list. Find the highest frequency and return how many elements of the list belong to tags with that frequency.
Example 1
tags=[5, 7, 5, 9, 7, 2] → 4

5 and 7 are the most frequent, twice each, which makes 4 elements together.

Example 2
tags=[3, 3, 3, 8] → 3

Only 3 occurs three times, so the answer is 3.

Example 3
tags=[4, 1, 6] → 3

Every value occurs once, so all three elements count.

Constraints
  • 1 ≤ len(tags) ≤ 100
  • 1 ≤ tags[i] ≤ 100
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsThe Candidate With Most Votes EasyValues One Apart EasyEven Piles of Cards EasyMatching Domino Tiles EasyWords From Letter Tiles Easy
loading Python…
Input
tags=[5, 7, 5, 9, 7, 2]
Expected
4

Run checks the first 3 tests in your browser. Submit checks all 119 tests on the server, hidden ones included.