Subsets of arr bitwise

 void subarray(int*arr, int n){

    //hashmap

    for(int i=0;i<=(1<<n);i++){

        for(int j=0;j<n;j++){

            if(i&(1<<j)){

                cout<<arr[j]<<" ";

            }

        }

        cout<<endl;

    }

    

}

Comments

Popular posts from this blog

Sum of Even Numbers till N

Find the Runner-Up Score!

Print All Substrings