text: Minimum number of given operations required to convert a string to another string | C # implementation of the approach ; 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: using System ; class GFG { static int minOperations ( string s , string t , int n ) { int ct0 = 0 , ct1 = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( s [ i ] == t [ i ] ) continue ; if ( s [ i ] == '0' ) ct0 ++ ; else ct1 ++ ; } return Math . Max ( ct0 , ct1 ) ; } public static void Main ( ) { string s = "010" , t = "101" ; int n = s . Length ; Console . Write ( minOperations ( s , t , n ) ) ; } }