text: swap stores the number of swaps required imbalance maintains the number of imbalance pair
code: int swap = 0 , imbalance = 0 ; for ( int i = 0 ; i < chars . length ( ) ; i ++ ) { if ( chars [ i ] == ' [ ' ) {