Compute the XOR of all integers from M to N inclusive
Company: Tesla
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
Overview: Compute the bitwise XOR of every integer from m to n inclusive, where the bounds can reach one billion, so a simple loop is too slow. It tests reasoning about XOR properties and turning a range query into prefix values that can be computed in constant time.