Phone Interview
Questions: Question: Number of Ways to Build Sturdy Brick Wall
I solved the problem rather quickly and managed to write about 80% of the code. However, I couldn't fully complete it because the solution required a substantial amount of code while maintaining good coding practices.
Rating: Strong Hire
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 1
Questions: Question: A variation of this interview question.
Problem Statement: Given an integer n
, return a license plate number following this pattern:
Ranges:
00000-99999
A0000-Z9999
AA000-ZZ999
AAA00-ZZZ99
AAAA0-ZZZZ9
AAAAA-ZZZZZ
Helper Functions Provided:
padToBeginning(reqLen, charToPad, value)
: Pads the given character at the beginning of a string to achieve the required length.- Example:
padToBeginning(9, '0', '123') = 000000123
- Example:
alpha(value)
: Converts an integer into an alphabetic sequence.- Example:
alpha(0) = A
,alpha(25) = Z
,alpha(26) = AA
- Example:
I initially thought I had completely bombed this interview because I got stuck multiple times. However, my recruiter later informed me that I received positive feedback across the board.
Rating: Lean Hire / Hire
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 2
Questions:
- Gift Buying Problem
- An uncle wants to buy gifts for his nephew. The nephew provides a list of gifts, where each gift has:
day
: The day the gift is available for purchaseprice
: The cost of the gift on that day
- Example:
3 4 4 2 6 4 10 5
- The uncle saves $1 per day and can only buy a gift on the specified day. If he skips a gift, he cannot buy it later. The goal is to determine the maximum number of gifts he can purchase.
- An uncle wants to buy gifts for his nephew. The nephew provides a list of gifts, where each gift has:
- Building Occupancy Problem
- Given security logs with timestamps for entry and exit of users, determine:
- The maximum occupancy of the building at any given time.
- The time at which that peak occupancy occurred.
- Given security logs with timestamps for entry and exit of users, determine:
I solved the first problem using a priority queue, even though the interviewer hinted toward a dynamic programming approach. The second problem was simple enough that I was only asked to explain the approach, not code it.
Rating: Strong Hire
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 3
Questions:
Problem: Given a chat log file, find the top N
most talkative users along with their total word count.
Example Log:
10:00 < John > Hi, How is everyone? 10:05 < Amy > Hello John 10:06 < Maria > Great, Having my morning coffee 13:00 < John > Let's meet this weekend 13:30 < Amy > Woahoo
Helper Function Provided:
parseLog(filepath)
: Returns the word count of each message.- Example Output:
[{'John', 4}, {'Amy', 2}, {'Maria', 5}, {'John', 4}, {'Amy', 1}]
- Example Output:
Follow-up Questions:
- Optimize for better complexity.
- Implement the
parseLog()
function.
I initially solved the problem using a priority queue and a hashmap for counting words per user. Then, I optimized it using the QuickSelect algorithm. The final follow-up seemed like a basic algorithm check, as we still had 10 minutes left.
Rating: Strong Hire
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Googlyness Round
Questions: This round focused on behavioral questions:
- Tell me about a time you advocated for yourself or a teammate.
- Describe your ideal workplace environment.
- How do you consider different customer segments when developing a product?
- Tell me about a time you handled multiple tasks at once.
Rating: Hire / Strong Hire
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Final Thoughts
Overall, my experience was positive, and I was fortunate to receive strong feedback across the rounds. I hope this helps others preparing for Google interviews. Good luck!