Find an index i such the a [ i ] is odd and compare length of both halfs excluding a [ i ] to find max length subarray
for ( int i = 0 ; i < n ; i ++ ) { if ( a [ i ] % 2 == 1 ) { len = Math . max ( len , Math . max ( n - i - 1 , i ) ) ; } } return len ; }