Maximum OR sum of sub | function to find maximum OR sum ; OR sum of all the elements in both arrays ; Driver code
function MaximumSum ( a , b , n ) { let sum1 = 0 , sum2 = 0 ; for ( let i = 0 ; i < n ; i ++ ) { sum1 |= a [ i ] ; sum2 |= b [ i ] ; } document . write ( sum1 + sum2 ) ; } let A = [ 1 , 2 , 4 , 3 , 2 ] ; let B = [ 2 , 3 , 3 , 12 , 1 ] ; let n = A . length ; MaximumSum ( A , B , n ) ;