Telephonic Round
Questions: The question presented was about processing a stream of incoming messages, each associated with a timestamp, and printing only the unique messages that appear within a 10-second window. This is similar to the "Logger Rate Limiter" problem on LeetCode. The problem was open-ended, and I had to ask several clarifying questions to fully understand it and frame the solution. I also created my own test cases and assumptions, which I discussed and confirmed with the interviewer.
Follow-up Question
The follow-up asked to ignore any duplicate messages within the 10-second interval.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
On-site Interview 1
Question: The problem presented a scenario where a city’s footpath is constructed using colored blocks, and we are to calculate the "beauty value" of the footpath. The beauty value is the longest sequence of blocks painted with the chief guest's favorite color.
For example:
- n = 9 (blocks), k = 6 (colors), block_colors = {6, 5, 2, 1, 2, 3, 2, 4, 5}, c = 2 → Beauty value = 1
- n = 10, k = 6, block_colors = {6, 5, 2, 1, 2, 2, 3, 4, 5, 2}, c = 2 → Beauty value = 2
The interviewer also asked for a function to implement this.
Follow-up 1
The interviewer then expanded the problem to handle multiple queries, where each query provides a different favorite color. The solution needed to return the beauty value for each of the queries.
Follow-up 2
The city department can repaint at most 'm' blocks to maximize the beauty value for a given favorite color. We were asked to find the maximum beauty value after repainting.
Examples:
- block_colors = {1, 2, 1, 2, 2, 3, 4, 2, 2, 2}, m = 3, c = 2 → Answer = 9
- block_colors = {1, 2, 1, 2, 1, 2, 3, 2, 2, 5, 4, 5, 6, 2, 2, 2}, m = 3, c = 2 → Answer = 8
There were additional follow-ups on the same question, which involved more complex cases and discussions around the time complexity and data structures.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
On-site Interview 2
Question: In a game where each player has 6 tiles, the winner is determined by who has the highest tile number. If Player 1 has [4, 4, 4, 4, 5, 6] and Player 2 has [5, 5, 5, 7, 8, 9], Player 2 wins due to the presence of the tile with the highest number, 9.
New Game: The new winning condition is based on the frequency of the tiles. For example:
- Player 1 [4, 4, 4, 4, 5, 6] has 4 of the number 4, and Player 2 [5, 5, 5, 7, 8, 9] has 3 of the number 5. Player 1 wins because their highest frequency is 4.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
On-site Interview 3
Question 1: We were tasked with writing a function to compute the "set" difference between two ranges of floating-point numbers. The solution needed to return the values in the first range that are not in the second range.
For example:
- a: [2.5, 7.5), b: [4.3, 9.3) → Answer: [2.5, 4.3)
- a1: [2.5, 9.5), b1: [4.5, 6.5) → We were asked to implement the function.
Question 2: What would change if the ranges were sorted and non-overlapping? The solution required adjusting the approach to handle multiple sorted ranges.
For example:
- a: [2.5, 7.5), [9.0, 10.4), b: [4.3, 9.3), [9.5, 11.0) → Answer: [2.5, 4.3), [9.3, 9.5)
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Googliness
The interviewer was very friendly and relaxed, asking general corporate experience and leadership-related questions. The overall atmosphere was positive.
Learning from the overall Experience
- Once the question is popped up, take a deep breath and understand the problem thoroughly.
- Don't rush into solving the problem.
- Ask relevant follow-ups and explain your solution and thought process first. Trust me, that really helps. All the best!!