2917. Find the K-or of an Array
You are given a 0-indexed integer array
nums, and an integerk.The K-or of
numsis a non-negative integer that satisfies the following:
- The
ithbit is set in the K-or if and only if there are at leastkelements of nums in which bitiis set.Return the K-or of
nums.Note that a bit
iis set inxif(2i AND x) == 2i, whereANDis the bitwiseANDoperator.
1 | class Solution { |