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
9 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...
-
DVR
iCkEdMeL
1 hour agoBOMBSHELL: Shooter’s Trans Partner Helped Take Him Down
9.75K8 -
1:42:45
The Big Migâ„¢
6 hours agoThe Islamic Invasion – The EU Has Fallen, A Warning For The USA |EP653
20.3K23 -
LIVE
Joker Effect
1 hour agoRUMBLE IN THE DEN 4 - Hungry fighters and NFL legend fight for respect
581 watching -
44:37
Rebel News
2 hours ago🔴 LIVE NOW: Massive ‘Unite the Kingdom’ Rally in London ft. Tommy Robinson | UKrebels.com
26.2K34 -
17:22
Professor Nez
2 hours ago💣BOMBSHELL: The Biden AutoPen Scandal JUST GOT REAL!
4.22K12 -
2:20:03
I_Came_With_Fire_Podcast
10 hours agoRevelations from the Ukrainian Front Lines
27.5K2 -
52:56
X22 Report
6 hours agoMr & Mrs X - Big Pharma Vaccine/Drug Agenda Is Being Exposed To The People - Ep 7
85.3K50 -
1:41:59
THE Bitcoin Podcast with Walker America
11 hours ago $17.40 earnedThe Assassination of Charlie Kirk | Walker America, American Hodl, Erik Cason, Guy Swann
69K37 -
21:33
marcushouse
6 hours ago $1.19 earnedSpaceX Just Revealed the Plan for Starship Flight 11! 🚀
29.5K9 -
35:03
Clownfish TV
9 hours ago'Live by the Sword, Die by the Sword.' | Clownfish TV
34.5K84