LEVEL : Easy

QUESTION :

Alice has `n`

candies, where the `ith`

candy is of type `candyType[i]`

. Alice noticed that she started to gain weight, so she visited a doctor.

The doctor advised Alice to only eat `n / 2`

of the candies she has (`n`

is always even). Alice…

You are given an integer `n`

. An array `nums`

of length `n + 1`

is generated in the following way:

`nums[0] = 0`

`nums[1] = 1`

`nums[2 * i] = nums[i]`

when`2 <= 2 * i <= n`

`nums[2 * i + 1] = nums[i] + nums[i + 1]`

…

Given the array `arr`

of positive integers and the array `queries`

where `queries[i] = [Li, Ri]`

, for each query `i`

compute the **XOR** of elements from `Li`

to `Ri`

(that is, `arr[Li] `

). Return an array containing the result for the given **xor** arr[Li+1] **xor** ... **xor** arr[Ri]`queries`

.

**Example…**