Humpy likes to jump from one building to another. But he only jumps to next higher building and stops when no higher building is available. Stamina required for a journey is xor of all the heights on which humpy jumps until he stops.
If heights are [1 2 4], and he starts from 1, goes to 2 stamina required is \(1 \oplus 2 = 3\), then from 2 to 3. Stamina for the entire journey is \(1 \oplus 2 \oplus 4 = 7\). Find the maximum stamina required if can start his journey from any building.
Input
First line: $$N$$, no of buildings.
Second line: $$N$$ integers, defining heights of buildings.
Output
Single Integer that is the maximum stamina required for any journey.
Constraints
\(1 \le N \le 10^5\)
\(1 \le Heights \le 10^9\)
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
Login to unlock the editorial