Tap here to switch tabs
Problem
Submissions

Problem: Degree of an Array

med
30 min
Try to solve the Degree of an Array problem.

Statement

Given a non empty integer array nums, define the degree of nums as the maximum frequency of any value in the array. Return the minimum length of a contiguous subarray of nums whose degree is equal to the degree of the entire array.

Constraints:

  • 1≤1 \leq nums.length ≤50000\leq 50000

  • 0≤0 \leq nums[i] ≤49999\leq 49999

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Degree of an Array

med
30 min
Try to solve the Degree of an Array problem.

Statement

Given a non empty integer array nums, define the degree of nums as the maximum frequency of any value in the array. Return the minimum length of a contiguous subarray of nums whose degree is equal to the degree of the entire array.

Constraints:

  • 1≤1 \leq nums.length ≤50000\leq 50000

  • 0≤0 \leq nums[i] ≤49999\leq 49999