Longest equal zero-one subarray

Write codeMedium20 minMeta style

Your task

Given a binary array nums containing only 0s and 1s, return the length of the longest contiguous subarray that contains an equal number of 0s and 1s. If no such subarray exists, return 0. Here 1 <= len(nums) <= 10^5.

Examples

find_max_length(nums: list[int]) -> int
Example 1
Inputfind_max_length([0, 1, 0])
Output2