Practice Minimum Array End
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given two integers n and x. You have to construct an array of positive integers nums of size n where for every 0 <= i < n - 1, nums[i + 1] is greater than nums[i], and the result of the bitwise AND operation between all elements of nums is x. Return the minimum possible value of nums[n - 1].
Source: Minimum Array End on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 3, x = 4
Output
6
# Example 2
Input
n = 2, x = 7
Output
15
Constraints
1 <= n, x <= 10^8
Related LeetCode Problems
Practice more problems similar to Minimum Array End.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.