Count of binary strings of given length consisting of at least one 1 | Function to return the count of Strings ; Calculate Math . pow ( 2 , n ) ; Return Math . pow ( 2 , n ) - 1 ; Driver Code
function count_Strings ( n ) { var x = 1 ; for ( i = 1 ; i < n ; i ++ ) { x = ( 1 << x ) ; } return x - 1 ; } var n = 3 ; document . write ( count_Strings ( n ) ) ;