2917. Find the K-or of an Array
You are given a 0-indexed integer array
nums
, and an integerk
.The K-or of
nums
is a non-negative integer that satisfies the following:
- The
ith
bit is set in the K-or if and only if there are at leastk
elements of nums in which biti
is set.Return the K-or of
nums
.Note that a bit
i
is set inx
if(2i AND x) == 2i
, whereAND
is the bitwiseAND
operator.
1 | class Solution { |