2644. Bitwise OR of All Subsequence Sums

Medium
Array
Math
Bit Manipulation
Brainteaser
Prefix Sum

Description

Hints

Hint 1
Think of each bit separately, i.e. try to figure out if <code>i<sup>th</sup></code> bit is set in the answer.
Hint 2
<code>i<sup>th</sup></code> bit is set in the answer if it's set in one of the array elements or it can be made using some of them.
Hint 3
Try to sum up lower bits and make higher bits.

Statistics

Acceptance
64.2%
Submissions
6,889
Accepted
4,420