Tap here to switch tabs
Problem
Submissions

Problem: Contiguous Array

Contiguous Array asks you to find the longest contiguous subarray in a binary array with equal numbers of zeros and ones, then return its length.

Statement

You are given a binary array nums containing only 0s0s and 1s1s. Your task is to find the maximum length of a contiguous subarray in which the number of 0s0s and 1s1s is exactly equal.

Return the length of the longest such subarray.

Constraints:

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

  • nums[i] is either 00 or 11.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Contiguous Array

Contiguous Array asks you to find the longest contiguous subarray in a binary array with equal numbers of zeros and ones, then return its length.

Statement

You are given a binary array nums containing only 0s0s and 1s1s. Your task is to find the maximum length of a contiguous subarray in which the number of 0s0s and 1s1s is exactly equal.

Return the length of the longest such subarray.

Constraints:

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

  • nums[i] is either 00 or 11.