Else find the length .
int [ ] arr = new int [ MAX ] ; for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = ( s [ i ] == '0' ? 1 : - 1 ) ; int [ , ] dp = new int [ MAX , 3 ] ; for ( int i = 0 ; i < MAX ; i ++ ) for ( int j = 0 ; j < 3 ; j ++ ) dp [ i , j ] = - 1 ; return findlength ( arr , s , n , 0 , 0 , dp ) ; }