Tap here to switch tabs
Problem
Submissions

Problem: Longest Balanced Subarray I

Try to solve the Longest Balanced Subarray I problem.

Statement

You are given an integer array nums.

A subarray is defined as balanced if the count of distinct even numbers in the subarray is equal to the count of distinct odd numbers in the subarray.

Return the maximum length of a balanced subarray in nums.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Balanced Subarray I

Try to solve the Longest Balanced Subarray I problem.

Statement

You are given an integer array nums.

A subarray is defined as balanced if the count of distinct even numbers in the subarray is equal to the count of distinct odd numbers in the subarray.

Return the maximum length of a balanced subarray in nums.

Constraints:

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

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