Perform OR operation on each bit
for ( int i = 0 ; i < max_size ; i ++ ) { int curr_bit = 0 ; for ( int j = 0 ; j < n ; j ++ ) curr_bit = curr_bit | ( arr [ j ] [ i ] - '0' ) ; res += ( curr_bit + '0' ) ; }