Check if N can be obtained from 1 by repetitively multiplying by 10 or 20 | Function to check if N can be obtained or not ; Count and remove trailing zeroes ; Check if remaining N is a power of 2 ; To check the condition to prlong YES or NO ; Driver code
function Is_possible ( N ) { let C = 0 ; let D = 0 ; while ( N % 10 == 0 ) { N = N / 10 ; C += 1 ; } if ( Math . pow ( 2 , ( Math . log ( N ) / ( Math . log ( 2 ) ) ) ) == N ) { D = ( Math . log ( N ) / ( Math . log ( 2 ) ) ) ; if ( C >= D ) document . write ( " " ) ; else document . write ( " " ) ; } else document . write ( " " ) ; } let N = 2000000000000 ; Is_possible ( N ) ;