Minimum count of Full Binary Trees such that the count of leaves is N | Function to return the minimum count of trees required ; To store the count of set bits in n ; Driver code
function minTrees ( n ) { let count = 0 ; while ( n > 0 ) { n &= ( n - 1 ) ; count ++ ; } return count ; } let n = 7 ; document . write ( minTrees ( n ) ) ;