Update - Received the offer finally :) - https://leetcode.com/discuss/compensation/2767037/Google-India-SWE-or-L4-or-Offer
YOE - 2 years
TC - 55L
Hi all, I recently gave all rounds for Google L4. This community has helped me in a lot of ways so I thought to give back. Also, I am writing this as it gives a feeling of closure as I am done with all the rounds and also know the feedback (but ofcourse need to wait until freeze lifts).
I won't discuss exact problems but very much similar to what I was asked.
PhoneScreen
My phonescreen took place in Jan 2022. I don't remember as it was long back. I was asked a question similar to this.
Given some Airports and some paths. Find out if there is a path b/w all airports. If not, add minimum paths to make all reachable. This was simply connected components. Then he asked a followup on adding airports as well as paths. (I have done this before so came up with the Prim's algo by adding a dummy node).
I received a feedback that my solution was optimal but I missed one edge case (which I corrected in the call but was called out) and also I could have used better data structures. They asked me to wait for few months and interview again skipping phonescreen that time. I kept practicing meanwhile and had my next rounds in July, Aug.
Onsite Round 1
Question - I was asked to find kth largest in an infinite stream of integers with k as constant. I came up with the min heap approach.
Follow Up - Now K is variable and changes with each new integer. I came up with first a binary search on prefix sum and then a segment tree approach. He seemed to be satisfied.
I also asked clarifying questions.
Verdict - Strong Hire/Hire
Onsite Round 2
Question - Given an array. Find sum of all the subarrays such that subarray is in AP.
E.g. 7, 4, 5, 6, 5, Output = 86
Explanation
[7], [4], [5], [6], [5],
[4, 5], [5, 6], [6, 5], [7,4]
[4, 5, 6]
Sum of all is 86
I came up with a O(N) time and O(N) space complexity. He asked me to optimise space so I came up with O(1) space. He was satisfied from optimality point of view. With this we hit 45 min.
I received feedback that solution is optimal. No major callouts. Communication could have been better and also that my skills are average problem solving (didn't understand completely. Maybe he was expecting me do it more fast). But recruiter said, we are good and the callouts are minor.
Verdict - Hire/Lean Hire
Onsite Round 3
Question. Similar to this
Given an n*m grid, each cell is 0/1. 0 means you can work on it, and 1 means obstacle. You start from the top left cell.
Try reaching the bottom right cell moving in any of 8 directions with a shortest path. You can remove atmost any K obstacles
Follow up - Now you can remove obstacles either in a "+" form or "X" form with some cost attached to it.
I did both of them using bfs + dp (with a slight tweak in dp transitions for the follow up)
Verdit - Strong Hire
Onsite Round 4
This was Behavorial round. I was asked basic behavorial questions revolving around my experience and my leadership qualities.
Verdict - Strong Hire
Recruiter said we are good with the feedbacks. But getting a HC slot itself is a challenge. So, I am part of the wait queue as well now. Hope to hear some positive news in upcoming months.
I used to do CP in college and my LC stands around 140 questions with 90 Medium 40 Hard and rest easy.
Best of luck if you are preparing for interviews!!