Tap here to switch tabs
Problem
Submissions

Problem: Minimum Array End

Minimum Array End asks you to build an array of a given size and positive integers that strictly increase, with a specified bitwise AND. Return the smallest final value.

Statement

You are given two integers n and x. You must construct an array of positive integers nums of size n such that:

  • nums is strictly increasing.

  • The bitwise AND of all elements in nums is equal to x.

Return the minimum possible value of nums[n - 1].

Constraints:

  • 1≤1 \leq n, x ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Array End

Minimum Array End asks you to build an array of a given size and positive integers that strictly increase, with a specified bitwise AND. Return the smallest final value.

Statement

You are given two integers n and x. You must construct an array of positive integers nums of size n such that:

  • nums is strictly increasing.

  • The bitwise AND of all elements in nums is equal to x.

Return the minimum possible value of nums[n - 1].

Constraints:

  • 1≤1 \leq n, x ≤108\leq 10^8