Google L4 Interview Experience
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-06-06Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
Round 1:
Question: Given some neighborhoods(sa 3) each having some houses(say 3) and each house represented by a number. Find a way to rearrange houses such that:
1. No two houses in the same neighborhood have the same number
2. Each neighborhood has the house numbers in ascending order
There will always be atleast one solution. If there are multiple solutions return anyone of them.
Example: ((7,8,9), (4,6,4), (4,2,6))
Output: ((4,6,8), (2,4,9), (4,6,7))
I messsed up in the interview and started coding without a clear idea first. then i changed multiple approaches midway and wasted a lot of time. But the best i could do was to find the frequency map of the numbers then arranged it in the order of frequency like this
[
[7,8,9,2],# numbers having frequency 1
[6],# numbers having frequency 2
[4] # numbers having frequency 3
]
Then i wanted to go in reverse order and assign the highest frequency elements to empty buckets, but i messed up in the assignment part. Would be grateful if someone could help with the correct approach for this.
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
Round 1:
Question: Given some neighborhoods(sa 3) each having some houses(say 3) and each house represented by a number. Find a way to rearrange houses such that:
1. No two houses in the same neighborhood have the same number
2. Each neighborhood has the house numbers in ascending order
There will always be atleast one solution. If there are multiple solutions return anyone of them.
Example: ((7,8,9), (4,6,4), (4,2,6))
Output: ((4,6,8), (2,4,9), (4,6,7))
I messsed up in the interview and started coding without a clear idea first. then i changed multiple approaches midway and wasted a lot of time. But the best i could do was to find the frequency map of the numbers then arranged it in the order of frequency like this
[
[7,8,9,2],# numbers having frequency 1
[6],# numbers having frequency 2
[4] # numbers having frequency 3
]
Then i wanted to go in reverse order and assign the highest frequency elements to empty buckets, but i messed up in the assignment part. Would be grateful if someone could help with the correct approach for this.