Subset Generator Using Bit Manipulation
#string int main() { string a="AiKichi"; for(ll i=0;i<(1<<a.length());++i) { for(ll j=0;j<a.length();j++) { if(i & (1<<j)) cout<<a[j]<<" "; } cout<<endl; } } #int_array int main() { long long a[]={1,2,3,4,5,6}; long long n=sizeof(a)/sizeof(a[0]); for(ll i=0;i<(1<<n);++i) { for(ll j=0;j<n;j++) { if(i & (1<<j)) cout<<a[j]<<" "; } cout<<endl; } }