Equal 0s and 1s

0

0 votes
Easy
Problem

Given an array of 0's and 1's. Write a program which print the size of the largest contiguous sub array with equal number of 0's and 1's .

Input

The first line of input is a number N denoting the size of the array and in the next line are N space separated values of A [ ].

Output

Print the length of max contiguous subarray.

0 < N < 100000

Sample Input
7
1 0 1 1 1 0 0
Sample Output
6
Time Limit: 1
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?