NVIDIA Interview Question

3. I only had one data structures and algorithm question, and that was computing the parity for each pair for an array of numbers. For instance, {1, 2, 3} = {0b1, 0b10, 0b11}. A pair would be (1, 3), and the parity of that would be 1 (1 XOR 1 XOR 1 = 1).

Interview Answer

Anonymous

Aug 13, 2016

3. I solved this the naive O(n^2) way, which should be obvious to the reader. My interviewer asked for a O(n) way but I couldn't think of it.