Practice Find the Maximum Sequence Value of Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Hard#3287
LeetCode ProblemFind the Maximum Sequence Value of Array
Problem Statement
Given nums and k, choose a subsequence of exactly 2 * k elements, preserving their order. Its value is the bitwise OR of its first k elements XOR the bitwise OR of its last k elements. Return the largest possible value.
Source: Find the Maximum Sequence Value of Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [2,6,7], k = 1
Output
5
# Example 2
Input
nums = [4,2,5,6,7], k = 2
Output
2
Constraints
2 <= nums.length <= 400
1 <= nums[i] < 2^7
1 <= k <= nums.length / 2
Related LeetCode Problems
Practice more problems similar to Find the Maximum Sequence Value of Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.