Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The optimal solution should apply all the k operations on a single number.
Calculate the prefix or and the suffix or and perform k operations over each element, and maximize the answer.