Count minimum bits to flip such that XOR of A and B equal to C | C # code to count the Minimum bits flip in A and B ; If both A [ i ] and B [ i ] are equal ; If Both A and B are unequal ; Driver code ; N represent total count of Bits
using System ; class GFG { static int totalFlips ( string A , string B , string C , int N ) { int count = 0 ; for ( int i = 0 ; i < N ; ++ i ) { if ( A [ i ] == B [ i ] && C [ i ] == '1' ) ++ count ; else if ( A [ i ] != B [ i ] && C [ i ] == '0' ) ++ count ; } return count ; } public static void Main ( ) { int N = 5 ; string a = "10100" ; string b = "00010" ; string c = "10011" ; Console . Write ( totalFlips ( a , b , c , N ) ) ; } }