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
6 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...
-
2:05:44
Side Scrollers Podcast
18 hours agoCalifornia is LOST, YouTube LOOSENS Rules, YouTuber SHOT Over Beef + More | Side Scrollers Live
23.3K28 -
LIVE
B2ZGaming
3 hours agoDivision 2 | B2Z Gaming
570 watching -
11:11
MattMorseTV
14 hours ago $1.73 earnedNewsom's FUNDING just got EXPOSED.
30.7K71 -
8:07
Dr. Nick Zyrowski
6 days agoHigh Dose Vitamin D Increases Fat Loss & Muscle Growth - New Study
9.15K5 -
LIVE
sKoRpSteR
7 hours ago🔴LIVE RUMBLE GAMING - quick stuff
11 watching -
4:13:41
The Pascal Show
18 hours ago $0.12 earnedDIDDY TRIAL LIVE! Jane Doe 'Victim #2' Defense CROSS! Diddy Trial Day 20
5.83K -
LIVE
tacetmort3m
2 hours ago🔴LIVE - VETERAN PLAYER SHOWING HOW ITS DONE - WARHAMMER 40K DARKTIDE
8 watching -
LIVE
TruthStream with Joe and Scott
13 hours agoSatan and Lucifer part 3, what is the difference? Inversion and Manipulation? A deep dive into an intriguing topic with Ethan Lucas, Restream #441
514 watching -
2:00:03
MG Show
18 hours agoLA Riots Battle of the Narratives; Optics vs Reality
15.9K17 -
1:23:40
The Chris Cuomo Project
23 hours agoWhy Scott Galloway Says the LA Protests HELP Trump
5.55K1