Minimum number using set bits of a given number | An efficient C ++ program to find minimum number formed by bits of a given number . ; Returns minimum number formed by bits of a given number . ; _popcnt32 ( a ) gives number of 1 's  present in binary representation  of a. ; Driver function .
#include <bits/stdc++.h> NEW_LINE #define ll  unsigned int NEW_LINE using namespace std ; ll minimize ( ll a ) { ll n = _popcnt32 ( a ) ; return ( pow ( 2 , n ) - 1 ) ; } int main ( ) { ll a = 11 ; cout << minimize ( a ) << endl ; return 0 ; }