Premium Only Content
This video is only available to Rumble Premium subscribers. Subscribe to
enjoy exclusive content and ad-free viewing.
![3133. Minimum Array End](https://1a-1791.com/video/s8/6/O/Z/I/6/OZI6u.qR4e.jpg)
3133. Minimum Array End
2 months ago
3
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].
Example 1:
Input: n = 3, x = 4
Output: 6
Explanation:
nums can be [4,5,6] and its last element is 6.
Example 2:
Input: n = 2, x = 7
Output: 15
Explanation:
nums can be [7,15] and its last element is 15.
Constraints:
1 <= n, x <= 108
#define ll long long
class Solution {
public:
long long minEnd(int n, int x) {
ll result=x;
while(--n){
result = (result+1) | x;
}
return result;
}
};
Loading comments...
-
1:05:35
Man in America
11 hours agoFort Knox & Trump’s Secret Gold Move—The Financial Reset NO ONE Is Ready For?
58K29 -
2:21:20
Robert Gouveia
7 hours agoTrump Goes to SCOTUS! Judge CAVES on DOGE? Fani Willis Not Happy!
89.9K26 -
20:41
Stephen Gardner
7 hours ago🔥You Won't BELIEVE What JUST Happened To Don Trump Jr.!!
89.7K129 -
58:00
The StoneZONE with Roger Stone
6 hours agoEuropean Leaders Resist Trump Peace Overtures To Their Own Demise | The StoneZONE w/ Roger Stone
63.3K11 -
9:29
AlaskanBallistics
7 hours ago $4.38 earnedWyoming Suppressors and Rifles at Shot Show 2025
64.3K3 -
1:06:40
Donald Trump Jr.
11 hours agoThe Left is Taking one L After Another, Live with Michael Knowles | Triggered Ep. 217
159K109 -
47:17
Kimberly Guilfoyle
11 hours agoWoke Gets DOGE’d, Live with AJ Rice & Jarrett Stepman | Ep. 197
119K42 -
20:11
Candace Show Podcast
10 hours agoBecoming Brigitte: Candace Owens x Xavier Poussard | Ep 6
178K313 -
8:25:38
Dr Disrespect
14 hours ago🔴LIVE - DR DISRESPECT - ELDEN RING DLC - REVENGE
185K22 -
54:22
LFA TV
1 day agoThe End of the Trans-Atlantic Alliance | TRUMPET DAILY 2.17.25 7PM
44.7K6