text: Number of ways to split a binary number such that every part is divisible by 2 | Javascript implementation of the approach ; Function to return the required count ; If the splitting is not possible ; To store the count of zeroes ; Counting the number of zeroes ; Return the final answer ; Driver code
code: var maxN = 20 ; var maxM = 64 ; function cntSplits ( s ) { if ( s [ s . length - 1 ] == ' ' ) return 0 ; var c_zero = 0 ; for ( var i = 0 ; i < s . length ; i ++ ) c_zero += ( s [ i ] == ' ' ) ; return Math . pow ( 2 , c_zero - 1 ) ; } var s = " " ; document . write ( cntSplits ( s ) ) ;