Tap here to switch tabs
Problem
Submissions

Problem: Construct the Minimum Bitwise Array I

med
30 min
Try to solve the Construct the Minimum Bitwise Array I problem.

Statement

Given an array nums consisting of prime numbers, construct an array ans of the same length.

For each index i, ans[i] must be the minimum non negative integer such that ans[i] ext{ OR } (ans[i] + 1) = nums[i]. If no such integer exists for an index i, set ans[i] to −1-1.

Return the array ans.

Constraints:

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

  • 2≤2 \leq nums[i] ≤1000\leq 1000

  • nums[i] is a prime number.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Construct the Minimum Bitwise Array I

med
30 min
Try to solve the Construct the Minimum Bitwise Array I problem.

Statement

Given an array nums consisting of prime numbers, construct an array ans of the same length.

For each index i, ans[i] must be the minimum non negative integer such that ans[i] ext{ OR } (ans[i] + 1) = nums[i]. If no such integer exists for an index i, set ans[i] to −1-1.

Return the array ans.

Constraints:

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

  • 2≤2 \leq nums[i] ≤1000\leq 1000

  • nums[i] is a prime number.