dp [ i ] [ 0 ] = Flips required to make all previous bits zero Flip required to make current bit zero
if ( a . charAt ( i ) == ' ' ) { dp [ i ] [ 0 ] = dp [ i - 1 ] [ 0 ] + 1 ; } else dp [ i ] [ 0 ] = dp [ i - 1 ] [ 0 ] ;