I have a phone interview with Google. Yesterday I paid for Leetcode premium and tried the "Google Phone Interview" in the mock interview section. Totally overwhelmed by one question in the test set. Couldn't solve the question at all. Came up with the correct idea but wasnt able to code. This is the question. https://leetcode.com/problems/minimum-area-rectangle/description/ I've solved < 200 questions on LC, mostly feel confident solving the general LC medium questions. But this one is way more difficult for me than the other questions. How can I improve this kind of question? What kind of practice do I need to improve this area? And if you know any other nice Google phone interview tips, please share. Cheers! 🍺🍺🍺
Try not to fixate too much on one question that you couldn’t figure out. You’ll never get to a point where you’ll never be stumped. Instead, enjoy a little encouragement in the fact that you are probably far more prepared than the average candidate. Good luck.
Thanks for encouraging me. That really helps!
Brute force is O(n^4) you’d have to check every possible rectangle, it’s inefficient and hard to code, but should at least be mentioned when the better solution does not come to mind Better solution is double for loop O(n^2) check outer loop is one corner, and inner loop is other corner, then have points also stored in hashset for fast lookup to see if other two corners exist O(n) space for the hashset The code for this solution is relatively simple and elegant maybe 5-10 lines, done, should take 20 minutes of discussion and coding leaving another 25 minutes for interviewer to ask their “real” question
It’s not that hard to code in python , what language are you using ?
C++. I couldnt turn it into a code. Probably should try again in the night.
ouch, with C++ anything is hard
For a person with some regular prep, this is definitely a good medium but not a hard one or may be lower hard.
Retried and mastered it. Thanks! 😁
I had this question when i was applying for a grad position back in 2014. It really crushed my dreams at Google...
😥
lol it's not such a hard question.. ask any game developer how he does collision testing of the objects on screen :) .
Doing it soon! Nervous!
Good luck! Be calm and joyful.
Thanks! Ive done it. there was major audio disruption from the beginning so done the interview through typing into the doc. Really different experience, and I guess my performance was not good. Worst luck ever. :)
Google like it hard
Seems like it. Do you think the company specific questions on Leetcode are close to the real ones?
Yes, you should sort them by frequency. Also Google sometimes won't ask the exact same questions, so you have to understand the underlying concept.