Shubham and Subarray Xor
Practice
4.4 (5 votes)
Advanced data structures
Data structures
Medium
Tries
Medium
Problem
66% Success 2849 Attempts 30 Points 1s Time Limit 257MB Memory 1024 KB Max Code

You are given an array consisting of n integers \(a_1,a_2,..a_n\). Find the maximum value of xor of sum of 2 disjoint subarrays i.e maximize ( sum(\(l_1,r_1\)) xor sum(\(l_2,r_2\)) )
where \(1\le l_1\le r_1 \) < \(l_2\le r_2\le n\).
Note: sum(l,r) denotes sum of elements from indices l to r both inclusive.

Input Format
First line contains number n denoting the number of array elements.
Second line contains n integers denoting \(a_1,a_2,..a_n\).

Output Format
Output the required value.

Constraints
\(1\le n\le 900 \)
\(1\le a_i\le 100 \)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
25 votes
Tags:
ApprovedData StructuresMediumReadyTries
Points:30
15 votes
Tags:
Binary SearchData StructuresMediumTries
Points:30
10 votes
Tags:
TrieAdvanced Data StructuresData Structures