Status: Grad School 2018 from BITS, Pilani
Position: Software Developer at a Auto Company
Location: Bangalore, India
Date: March 8th, 2020
Technical phone screen (1 hour):
Now is my time to give back to LeetCode Community.
I recently attended Google Phone Screen for Bangalore Location.
Input: Given an array of Integers containing '0's and '1's Ex: A = [0, 0, 1, 0, 0]
Description: Find the number of ways in which we can form valid strings of '0's.
Output: 4 [0, 00, 0, 00]
I started with using left and right pointers to count the number of valid strings of '0's. Then I thought maybe using a sliding window along with 2 pointers, to count the number of strings is a good approach.
After struggling through 15 mins, I informed the interviewer about my approach. She suggested that i look for a solution using a single pointer since sliding window is not a very optimal solution( Because if the array size is large, we need to count for window length starting from 1, 2 and so on)
I came up with the mathematical approach using a single pointer and summing up the number of 0's seen previously, using sum of N natural numbers
Number of '0's = N * (N + 1) /2;
I finally found the solution but forgot to cover the edge cases since the time was less( I was left with last 2 mins to conclude)
Result : I was informed about my rejection the next day.
Few Lessons that i learnt which can be helpful to someone applying in future.
1. Think through the problem carefully
The problem never seemed like a mathematical one. I thought of 2 pointers and sliding window, but final solution turned out to be something different. Had i spend some more time pondering the problem, maybe I would have come up with the real solution to the problem
2. Cover all the edge cases
Google is a bit strict on all the edge cases. Though I came up with the solution, I was rejected because I did not cover the edge cases. So make sure you cover all the edge cases along with main solution.
3. Communication with the Interviewer
The reason behind my rejection is also because I did not explain my thought process clearly to the interviewer. She was not able to guide me through the problem since she was not clear about my approach using 2 pointers and sliding window. So speak your thoughts clearly so that the interviwer can guide you through. I felt that we were having a communication gap throughout the interview, but ignored this since I was busy finding the actual solution. I was given feedback that I did not speak out my thoughts clearly.
Hope this helps to all the readers who are planning to apply in future :)
Never Lose Hope, Fail Again and Try Harder next time :)