Count minimum removals to obtain strings of the form "00000 . . . . " or "11111 . . . "
var ans = Math . min ( total_zeros , total_ones ) ; var cur_zeros = 0 , cur_ones = 0 ; for ( var i = 0 ; i < str . length ; i ++ ) {