Contiguous Array

Given a binary array nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.

Constraints

  • 1 <= nums.length <= 10^5
  • nums[i] is either 0 or 1.
Saving… · 2 lines
class Solution:
def maxLengthContiguousArray(self, nums: List[int]) -> int:
Console

Click Run to execute sample tests.