#3845

Maximum Subarray XOR with Bounded Range

international master · 1960 · lc hard +32 · 31.1% accepted · 61 likes · top 9%

Description

Given a non-negative integer array nums and an integer k, choose a subarray whose maximum element minus minimum element is at most k. The value of a subarray is the bitwise XOR of all its elements. Return the maximum possible XOR value over all valid subarrays.

Code

1
2
3