Google
Top Google Software Engineer Interview Questions 2026
Prep tips for Google SWE
- Google values clean, correct code over speed — explain your thinking aloud
- Always analyze time and space complexity before finalizing your solution
- System design rounds expect scalability thinking: sharding, caching, load balancing
- Behavioral rounds follow the STAR format — have 3–4 strong examples ready
- Use a hash map. Iterate once: for each number, check if
target - numexists in the map. If yes, return both indices. If no, storenum → index. O(n) time, O(n) space. Walk through an example: [2,7,11,15], target=9 → map stores {2:0}, then 7: 9-7=2 found at index 0, return [0,1]. - Use a doubly linked list + hash map. Map stores key → node pointer for O(1) lookup. List maintains access order (most recent at head). On get: move node to head. On put: add at head; if over capacity, evict tail. Both operations O(1).
- BFS from the start word. At each level, try all single-character replacements. Use a set for the word list for O(1) lookup. Remove visited words from the set to avoid cycles. BFS guarantees the shortest path. Time: O(M² × N) where M is word length, N is word count.
- Use BFS (level-order). Serialize: push root to queue, process nodes, append value or "null" to result string, push children. Deserialize: split string, build queue, assign left/right children in order. Avoids recursive stack overflow on deep trees.
- Key components: (1) Operational Transformation (OT) or CRDT for conflict resolution on concurrent edits. (2) WebSocket server per document for real-time sync. (3) Document stored as a sequence of operations (event sourcing) — reconstruct state by replaying. (4) Separate read replicas for rendering. (5) Presence service (who's viewing). Cover CAP tradeoffs: favor availability + partition tolerance, accept eventual consistency.
- Sliding window of length p. Maintain two frequency arrays (or Counter dicts) — one for pattern p, one for current window. Slide the window: add right char, remove left char. If frequency arrays match, record start index. O(n) time.
- Upload: async pipeline — raw video → transcoding workers → multiple resolutions stored in object storage (GCS/S3). Streaming: CDN caches video chunks (HLS segments), adaptive bitrate based on client bandwidth. Metadata: sharded SQL (video info, comments) + separate NoSQL for view counts. Recommendation: offline ML pipeline, cached results. Focus on read-heavy optimization and CDN strategy.
- Use a min-heap of size K. Initialize with the head of each list. Pop minimum, add to result, push that node's next into heap. Repeat until heap empty. Time: O(N log K) where N is total nodes, K is number of lists. Better than brute-force merge which is O(NK).
- STAR structure: Situation — describe the technical context (e.g., choosing a monolith vs microservices). Task — what was your role and stake. Action — how you presented data/benchmarks to support your view, listened to others, sought consensus. Result — outcome, what you learned about technical advocacy. Google values intellectual humility — show you can be wrong too.
- Two-pointer approach. Maintain left_max and right_max. Move the pointer with the smaller max: water at that position = max - height[i]. This avoids the O(n) extra space of the prefix array approach. O(n) time, O(1) space.
- Hashing: MD5 or SHA256 of long URL → take first 6-7 chars → check for collision in DB, retry with different chars. Base62 encoding of auto-increment ID is simpler. Storage: key-value store (Redis for hot URLs, Cassandra for durability). Redirect: 301 (permanent, cached by browser) vs 302 (temporary, every request hits server — better for analytics). Add expiry TTL support.
- Iterate grid. When you hit '1', increment count and BFS/DFS to mark all connected '1's as visited (set to '0'). BFS uses a queue; DFS is cleaner recursively but watch stack depth for very large grids. Time: O(M×N), Space: O(min(M,N)) for BFS queue.
- Choose a project with measurable impact. Structure: context (what problem, why it mattered), your specific contribution (not "we"), technical challenges faced, how you resolved them, and quantified outcome (latency reduced by X%, users grew by Y%). Google looks for ownership and impact — use numbers.
- Sliding window with two pointers. Expand right until all chars of t are covered (track with a counter and frequency map). Then shrink left to minimize window. Record minimum when all chars covered. Time: O(|S| + |T|). Key: use a "formed" counter to avoid checking the whole frequency map each step.
- Trie stores prefix → list of top-K completions (by frequency). Pre-compute and cache top-K at each node during offline processing. For real-time: user types → query trie → return cached completions. Distributed trie sharded by first character. Cache hot prefixes in Redis. Latency requirement: <100ms → serve from in-memory cache, refresh from offline batch.
- Dynamic programming. dp[i] = minimum coins to make amount i. Initialize dp[0]=0, rest=infinity. For each amount from 1 to target: try each coin — dp[i] = min(dp[i], dp[i-coin]+1). Bottom-up, O(amount × coins) time, O(amount) space.
- Structure: (1) Detect — describe your monitoring/alerting setup. (2) Triage — determine blast radius and severity. (3) Mitigate first — rollback, feature flag, traffic routing — before debugging root cause. (4) Communicate — stakeholder updates on cadence. (5) Post-mortem — blameless, focus on systemic fixes. Google expects SRE thinking: SLOs, error budgets, runbooks.
- Expand-around-center approach: for each character, expand outward for both odd and even length palindromes. Track max length seen. O(n²) time, O(1) space. Manacher's algorithm gives O(n) but rarely expected in interviews — mention it for bonus points.
- Consistent hashing distributes keys across nodes; virtual nodes handle uneven load. Replication factor R (typically 3). Write quorum W, read quorum R: W+R > N for strong consistency (Dynamo model). Conflict resolution: vector clocks or last-write-wins. Gossip protocol for node membership. Cover compaction (LSM tree), bloom filters for fast miss detection.
- Google Googliness question. Show you can operate without full information. STAR: Situation with unclear requirements. Task — what decision needed to be made. Action — how you gathered data, set assumptions explicitly, made a call, and built in checkpoints to revisit. Result — shipped on time, learned X. Key: show initiative + structured thinking, not paralysis.
Practice these questions with Cogniv
Get real-time AI answers during live mock interviews. Free to start.
Start practicing →