Tap here to switch tabs
Problem
Submissions

Problem: Find the K-or of an Array

med
30 min
Try to solve the Find the K-or of an Array problem.

Statement

You are given a 00 indexed integer array nums and an integer k.

The K or of the array is computed such that the bit at position ii is set to 11 if and only if at least k elements in nums have the bit at position ii set to 11.

Return the integer representing the K or of nums.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 0≤0 \leq nums[i] <231< 2^{31}

  • 1≤1 \leq k ≤\leq nums.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the K-or of an Array

med
30 min
Try to solve the Find the K-or of an Array problem.

Statement

You are given a 00 indexed integer array nums and an integer k.

The K or of the array is computed such that the bit at position ii is set to 11 if and only if at least k elements in nums have the bit at position ii set to 11.

Return the integer representing the K or of nums.

Constraints:

  • 1≤1 \leq nums.length ≤50\leq 50

  • 0≤0 \leq nums[i] <231< 2^{31}

  • 1≤1 \leq k ≤\leq nums.length