As reported: Capital One Lead Software Engineer CodeSignal online assessment, Jun 2025: four problems in 70 minutes — an easy first problem on an even/odd alternating sequence, and a hard matrix problem applying a list of commands; the later statements were long.
nums is supposed to alternate between even and odd numbers. Return the first index i where the alternation is broken — nums[i] has the same parity as nums[i−1] — or -1 if the whole array alternates.
Example
[1,2,3,4,6,7] -> 4 (4 and 6 are both even)
[2,5,8,1] -> -1
Constraints: 1 ≤ nums.length ≤ 10^5; 0 ≤ nums[i] ≤ 10^9.
Code runner format: one line with nums. Implement firstParityBreak(nums); the harness prints the index.
Clarifications
- The array may start with either parity.