Google·Software Engineer·Onsite - Coding / Algorithms
Jun 2026
Google SWE coding round, one algorithmic problem about range queries on parity patterns. Pretty clean problem once you see the prefix sum trick, but I spent way too long trying to brute force it before the hint clicked.
- Given an integer array and a set of range queries [l, r], determine for each query whether the subarray has strictly alternating parity between adjacent elements. Preprocess the array so every query can be answered in O(1).
“My first instinct was to just iterate through each query range and check adjacent pairs, which is obviously too slow when there are a lot of queries.” The rest of the author's notes on Software Engineer interview at Google, Onsite - Coding / Algorithms round, covers how they worked through the question, what the panel pushed back on, and what they would do differently.
View Post