Problem · Bit Manipulation
Maximum XOR Suffix
Learn this problemProblem statement
An array of n integers, arr, is given. Pick any index then calculate the XOR of the array from that index through the highest index. Append the value to the array. Repeat this process zero or more times. Determine the highest value possible.
Function
maximumValue(arr: int[]) → int
Complete the function maximumValue in the editor below.
maximumValue has the following parameter:
int arr[n]: the starting array
Returns
int: the maximum possible value in the array
Examples
Example 1
arr = [8, 2, 4, 12, 1]return = 14
Explantion is shwon in the image above pint 👆👆
The max strength possible is 14.
Example 2
arr = [1, 2, 3]return = 3Regardless of what index is chosen, the XOR value can never be greater than 3 :)
Constraints
More Tiktok problems
- Count Access Code PairsOA · Seen Jul 2026
- Count Key ChangesOA · Seen Jul 2026
- Travel Distance on ScootersOA · Seen Jul 2026
- Count Skipped Numbers After SubtractionsOA · Seen Jul 2026
- Obstacle Placement QueriesOA · Seen Jul 2026
- Repeated Grouped Digit SumOA · Seen Jul 2026
- Count Cyclic Digit PairsOA · Seen Jun 2026
- Event ID Check Completion TimesOA · Seen Jun 2026