Question Details
I was asked this question in recent ByteDance OA Q) An array of n integers, arr, is given. Pick any index then calculate the XOR of the array from that...
Full Details
I was asked this question in recent ByteDance OA
Q) 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\xA0value\xA0possible.
Example
Input:
n = 5
[8, 2, 4, 12, 1]
Output:
14
Input:
n = 4
[0, 2, 5, 1]
Output:
7
Can anyone solve this.
About This Question
This is a reported interview question from a tiktok interview for a swe role during the oa round reported in 2024.
It covers the following topics: Arrays, Bit Manipulation .