Maximum XOR for Each Query

Problem Overview

  • Core task: For each query [l, r], find the maximum value of f over all contiguous subarrays inside arr[l..r], where f repeatedly XORs adjacent elements until one value remains.
  • Input/Output: Given int array arr and q queries (l, r); return one int per query—the maximum XOR value; constraints not specified.
  • Domain: Array processing and bitwise XOR reduction.
  • Company: From Uber interviews; a coding interview problem and common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: