You are given a 0-indexed integer array
nums
of lengthn
and an integerk
. In an operation, you can choose an element and multiply it by2
.Return the maximum possible value of
nums[0] | nums[1] | ... | nums[n - 1]
that can be obtained after applying the operation on nums at mostk
times.Note that
a | b
denotes the bitwise or between two integersa
andb
.
1 | class Solution { |