Practice Maximum OR
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 a 0-indexed integer array nums of length n and an integer k. In an operation, you can choose an element and multiply it by 2. Return the maximum possible value of nums[0] | nums[1] | ... | nums[n - 1] that can be obtained after applying the operation on nums at most k times. Note that a | b denotes the bitwise or between two integers a and b.
Source: Maximum OR on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [12,9], k = 1
30
# Example 2
nums = [8,1,2], k = 2
35
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum OR.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.