Minimum value among AND of elements of every subset of an array | C ++ program for the above approach ; Find AND of whole array ; Print the answer ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void minAND ( int arr [ ] , int n ) { int s = arr [ 0 ] ; for ( int i = 1 ; i < n ; i ++ ) { s = s & arr [ i ] ; } cout << ( s ) << endl ; } int main ( ) { int arr [ ] = { 1 , 2 , 3 } ; int n = sizeof ( arr ) / sizeof ( int ) ; minAND ( arr , n ) ; }