less than 1 minute read

Given a list of integers nums, find the most frequently occurring element and return the number of occurrences of that element.

Constraints

  • 0 ≤ n ≤ 100,000 where n is the length of nums

https://binarysearch.com/problems/High-Frequency

Examples

Example 1

Input

  • nums = [1, 4, 1, 7, 1, 7, 1, 1]

Output

  • answer = 5

Example 2

Input

  • nums = [5, 5, 5, 5, 5, 5, 5]

Output

  • answer = 7

Example 3

Input

  • nums = [1, 2, 3, 4, 5, 6, 7]

Output

  • answer = 1

Solution

Leave a comment