Tap here to switch tabs
Problem
Submissions

Problem: Minimum Array End

Try to solve the Minimum Array End problem.

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

Try to solve the Minimum Array End problem.

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