Your question is 3 XOR 2 Mod 5. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Wealthfront's Portfolio dashboard receives integer event codes for account activity. For each inclusive range query, compute the bitwise XOR of the event codes in that range, then return the result modulo modulus.
The operation order is explicitly (XOR of the range) % modulus. For example, 3 XOR 2 % 5 means (3 XOR 2) % 5 = 1.
Implement xor_range_modulo(values, queries, modulus).
values is a list of nonnegative integers.queries is a list of two-element lists [left, right], using zero-based inclusive indices.modulus is a positive integer.(values[left] XOR values[left + 1] XOR ... XOR values[right]) % modulus.def xor_range_modulo(values, queries, modulus):