Google | Onsite | SWE
Anonymous User
3686

Both these questions were asked to me in one of the onsite rounds for the Google SWE role.

Q1: Given some source code and a set of keyword substitutions, return the source code after performing all the substitutions. In other words, all occurences of a keyword X should be substituted by another keyword Y and multiple such pairs are provided.
A1: This was a straightforward coding question; the interviewer was focused on code correctness and edge case handling and not on algorithmic complexity.

Q2: A very similar question to this: https://leetcode.com/problems/rotting-oranges/

Personal Experience: Managed to solve both the questions however the interviewer had to point some edge case misses for the first one.

Advice: Get into the habit of double checking your code as you're writing it and DO NOT give any opportunity for the interviewer to point out bugs/mistakes because this can mean the difference between a good hire and a weak hire.

Comments (4)