Longest Subarray with Equal 0s and 1s Problem

Longest Subarray with Equal 0s and 1s Problem — ExecCode Easy DSA Practice

Solve the Longest Subarray with Equal 0s and 1s problem on ExecCode. Free online easy DSA practice in Hashing. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Longest Subarray with Equal 0s and 1s. Your task is to compute the required answer and return max equal-0-1 subarray length. A sequence of values is given, and order matters. In Longest Subarray with Equal 0s and 1s, the goal is to transform, count, or select values according to the exact rule. n, then n values 0/1.

Examples

Input {"nums": [0, 1, 0, 1, 0, 0]}; Output 4. Input {"nums": [1, 0, 1, 1, 0]}; Output 4. Input {"nums": [1, 1, 1]}; Output 0

Constraints

nums[i] in {0, 1}

Practice Longest Subarray with Equal 0s and 1s free on ExecCode. Browse DSA problems, topic map, and placement guides.