Program to Print all subarrays of a array in efficient way

void Subarray(int arr[],int n){
    for(long long i=0;i<(1<<n);i++){
        for(long long j=0;j<n;j++){
            if((i & 1<<j)>0) {
                cout<<arr[j];            }
         }
        cout<<endl;
    }
}

Comments

Popular posts from this blog

Efficient method to calculate XOR series

Instagram Script to Mass Follow Unfollow in One Click