Tap here to switch tabs
Problem
Submissions

Problem: Longest Semi-Repeating Subarray

med
30 min
Try to solve the Longest Semi-Repeating Subarray problem.

Statement

Given an integer array nums and an integer k, return the length of the longest contiguous subarray containing at most k distinct elements that appear at least 22 times.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

  • 0≤0 \leq k ≤\leq nums.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Semi-Repeating Subarray

med
30 min
Try to solve the Longest Semi-Repeating Subarray problem.

Statement

Given an integer array nums and an integer k, return the length of the longest contiguous subarray containing at most k distinct elements that appear at least 22 times.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

  • 0≤0 \leq k ≤\leq nums.length