Google PhoneScreening SDE2

Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2025-04-16Added By Anonymous
Source:Ā Link
🧭 Experience: unknown
āœ… Outcome: Reject
šŸ’° Compensation: unknown
šŸ“ Location: unknown
šŸ¢ Company: Google
šŸŽ“ Education: unknown
šŸŽ Benefits: unknown
šŸ“… Offer Date: unknown

YOE : 4Y+

Question Similar to

movie recommendation system. Each movie has a title and a rating, if the process has marked movie A as similar to movie B, and movie B similar to movie C, we will also consider movie A as similar to movie C

Given a movie from the list, return its N similar movies with highest rating.

For example, if we have the following four movies:

"Movie A" with rating 6 "Movie B" with rating 7 "Movie C" with rating 8 "Movie D" with rating 9 and the process has determined the following similarities:

"Movie A" is similar to "Movie B" "Movie B" is similar to "Movie C"



Solution I gave

https://leetcode.com/playground/YvepGCT9

Verdict : Reject

I was not prepare for the Interview got very nervous about approach so I mixed up with java and C++ syntax as it was just a normal text editor didn;t get noticed

Instead of min heap used Max heap

But this was the overall code that I used
Comments