Google | SWE Intern (Winter)| India | Sep 2022 | Rejected

google logo
google
swe internbangalore/hyderabadRejected
September 10, 20220 reads

Summary

I interviewed for a Software Engineer Intern position at Google in September 2022. Despite performing well in the first technical round, I struggled significantly with a hard dynamic programming problem in the second, ultimately leading to a rejection.

Full Experience

I had my interview for a SWE Intern position for Winter 2023 at Google, located in Bangalore/Hyderabad, during September 2-4, 2022. I went through two 45-minute technical interviews, both strictly focused on problem-solving with Data Structures and Algorithms.

Technical Interview 1:
This round was considered a MEDIUM level problem. After a warmup question about checking if a target x exists in a series of intervals, the main question was a follow-up. I was given a stream of queries (q), each with a target x, and my task was to return a boolean array indicating if each x exists in one or more given intervals. The interviewer clarified that the intervals were non-overlapping, sorted, and non-negative. The required time complexity was O(log N) and space O(1). We also discussed how to handle overlapping intervals as a final follow-up. The feedback from this round was positive; I successfully explained brute-force, a better approach, and the optimal binary search solution that was expected. The interviewer suggested I practice coding in a time-bounded environment for faster execution. He was quite chill, helpful, offered hints, and prioritized problem-solving approaches over perfect code.

Technical Interview 2:
This interview was a HARD level problem. I was presented with two lists of integers, A and B, representing daily profits for working at CityA and CityB, respectively. As a salesman, I needed to switch between these cities, with travel days (T) yielding zero profit. My goal was to output a schedule (like 'ATBB') that maximized total profit. Key clarifications from the interviewer included: arrays A and B would always have equal length, each index represented a day, travel days resulted in zero profit, I could work in a city for multiple days, but traveling was mandatory (I couldn't work solely in one city), and there would be no zero values in the profit arrays. After considerable effort, I realized it was a recursion-based problem, and the interviewer asked for a memoized dynamic programming solution. Despite my experience with DP problems, this specific type was unfamiliar, and I was stuck. I needed significant hints and, in the final minutes, could only produce a few lines of awfully broken code. The feedback for this round was to focus on solving hard-tagged dynamic programming problems from LeetCode. This interviewer was quite unhelpful, remaining silent while I struggled, and even had difficulty explaining the approach himself in the final moments. I couldn't fully grasp his explanation. While I know I need to improve, I strongly felt that with a little more guidance, I could have solved it. This experience taught me not to assume interviewers will always be helpful and to prepare in a way that minimizes the need for assistance. It was a tough day, but these things happen.

I am requesting the brilliant coders and problem solvers present in the LeetCode community to provide meaningful approaches and/or solutions to the problems I stated. It will be very helpful to me and others. A humble request for Java/Python solutions, as I really struggle with C++ codes. Thanks in advance! Happy LeetCoding!

Interview Questions (2)

Q1
Search Target in Stream of Non-Overlapping Sorted Intervals
Data Structures & AlgorithmsMedium

You are given a series of intervals in the form of a list of lists (e.g., [[1-3],[4-7],[9-21]]). Instead of a single target x, you will be given a stream of queries (q), where each query will have a target x. Return a boolean array (e.g., {True,False,True,...]) for given queries, True if they exist in one or more intervals, and False, if they do not exist in any of the given interval.

Testcase:
Input:
[[1-3],[4-7],[9-21]], queries = [4,6,8,10,15]

Output: [True,True,False,True,True]

Explanation -
Every query except 8, exists in the given intervals.

Clarifications from interviewer:
1. Intervals are non overlapping.
2. They are sorted.
3. You can assume there will be no negative intervals.

Required Time Complexity: O(log N)
Required Space Complexity: O(1)

Final follow up: What if the intervals were overlapping?

Q2
Maximize Salesman Profit with City Switches and Travel Days
Data Structures & AlgorithmsHard

Given two lists of integers, A and B, list A represents the daily profit of working at CityA and list B represents the daily profit of working at CityB. You are a salesman and you have to switch between CityA and CityB due to various client requirements. When you switch from CityA to CityB, you have to travel. The day you travel (T), cannot be considered as a working day, and hence your net profit on travel days are 0. Your task is to output a schedule which includes working as well as travelling such that your profit is maximized.

Example Testcase:
Input:
A[] = [23,4,5,2], B[] = [20,1,10,100]

Output:
"ATBB"

Explanation -
An optimal schedule will be-
Day 1 : Work at CityA -> profit is 23
Day 2 : Travel -> profit is 0
Day 3: Work at CityB -> profit is 10
Day 4: Work at CityB -> profit is 100

Clarifications from interviewer:
1. The length of array A and array B will always be equal. Each index of array A/B is treated as day(i), and the value at day(i) is your profit for that day (if you worked). If you travelled at day(i), profit for that day won't be added to your net profit.
2. You can work in a city for more than 1 day. But, travelling is mandatory. You cannot work in only city A or city B.
3. There will be no dreaded zeroes in any of the array values.

Required Time Complexity: O(N)
Required Space Complexity: O(N)

Preparation Tips

Based on the feedback from my interviews, I recognize the need to practice coding in a time-bounded environment for faster execution. For the second interview's challenge, I was specifically advised to tackle hard-tagged dynamic programming problems from LeetCode. A key takeaway for me is also to never assume interviewers will be explicitly helpful; therefore, preparing in a self-sufficient manner is crucial.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!