Minimum number of basic logic gates required to realize given Boolean expression | Function to count the total number of gates required to realize the boolean expression S ; Length of the string ; Stores the count of total gates ; Traverse the string ; AND , OR and NOT Gate ; Print the count of gates required ; Input ; Function call to count the total number of gates required
function numberOfGates ( s ) { let N = s . length ; let ans = 0 ; for ( let i = 0 ; i < s . length ; i ++ ) { if ( s [ i ] == ' ' s [ i ] == ' ' s [ i ] == ' ' ) { ans ++ ; } } document . write ( ans ) ; } let S = " " ; numberOfGates ( S ) ;