Ezvor

2505. Bitwise OR of All Subsequence Sums

MediumArray Preparing judge… LeetCode
ArrayMathBit ManipulationBrainteaserPrefix Sum

Hints

Hint 1
Think of each bit separately, i.e. try to figure out if ith bit is set in the answer.
Hint 2
ith 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.