Tap here to switch tabs
Problem
Submissions

Problem: Find the Longest Equal Subarray

Find the Longest Equal Subarray asks you to delete at most k elements from an integer array and return the maximum length of a contiguous block with identical values.

Statement

You are given an integer array nums and an integer k.

An equal subarray is defined as a contiguous sequence of elements within an array where every element is identical.

You may delete at most k elements from nums. Return the length of the longest possible equal subarray after performing these deletions.

Constraints:

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

  • 1≤1 \leq nums[i] ≤\leq nums.length

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Longest Equal Subarray

Find the Longest Equal Subarray asks you to delete at most k elements from an integer array and return the maximum length of a contiguous block with identical values.

Statement

You are given an integer array nums and an integer k.

An equal subarray is defined as a contiguous sequence of elements within an array where every element is identical.

You may delete at most k elements from nums. Return the length of the longest possible equal subarray after performing these deletions.

Constraints:

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

  • 1≤1 \leq nums[i] ≤\leq nums.length

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