Driver code
public static void main ( String args [ ] ) { int binary [ ] = { 1 , 1 , 1 , 0 , 0 , 1 , 0 , 1 , 1 } ; int n = binary . length ; pair left [ ] = new pair [ n ] ; for ( int i = 0 ; i < n ; i ++ ) left [ i ] = new pair ( 0 , 0 ) ; preCalculate ( binary , n , left ) ;