text: Minimum number of given operations required to convert a string to another string | Function to return the minimum operations of the given type required to convert string s to string t ; Characters are already equal ; Increment count of 0 s ; Increment count of 1 s ; Driver code
code: function minOperations ( s , t , n ) { var ct0 = 0 , ct1 = 0 ; for ( var i = 0 ; i < n ; i ++ ) { if ( s [ i ] === t [ i ] ) continue ; if ( s [ i ] === " " ) ct0 ++ ; else ct1 ++ ; } return Math . max ( ct0 , ct1 ) ; } var s = " " , t = " " ; var n = s . length ; document . write ( minOperations ( s , t , n ) ) ;