111: Contiguous binary array

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

 

Example 1

Input:   [0, 1, 1]

Output:  2

Example 2

Input:   [1, 1, 1]

Output:  0
Difficulty:Medium
Topic:HashSet
Problem #:111