Google | Phone Screening
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2024-10-07Added By Anonymous
Source: Link
🧭 Experience: unknown
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
I recently gave a phone screening round of google and was asked the following:
Given an array of objects which contains names of two friends and the time at which they became friends and the total no. of people. Find the minimum time when everybody becomes everybody's friend. ( If A is a friend of B and B is a friend of C then A is also a friend of C)
For eg:
Input:
Total people : 5
[ { time : 100ms, person1: A, person2: B}, { time : 200ms, person1: D, person2: E}, { time : 300ms, person1: A, person2: C}, { time : 400ms, person1: B, person2: C}, { time : 500ms, person1: E, person2: C}, { time : 600ms, person1: E, person2: A}]
Ans) They would all be friends by 500ms
(You can consider the array sorted according to time and the person1-person2 pair for each object would be unique)
✅ Outcome: unknown
💰 Compensation: unknown
📍 Location: unknown
🏢 Company: Google
🎓 Education: unknown
🎁 Benefits: unknown
📅 Offer Date: unknown
I recently gave a phone screening round of google and was asked the following:
Given an array of objects which contains names of two friends and the time at which they became friends and the total no. of people. Find the minimum time when everybody becomes everybody's friend. ( If A is a friend of B and B is a friend of C then A is also a friend of C)
For eg:
Input:
Total people : 5
[ { time : 100ms, person1: A, person2: B}, { time : 200ms, person1: D, person2: E}, { time : 300ms, person1: A, person2: C}, { time : 400ms, person1: B, person2: C}, { time : 500ms, person1: E, person2: C}, { time : 600ms, person1: E, person2: A}]
Ans) They would all be friends by 500ms
(You can consider the array sorted according to time and the person1-person2 pair for each object would be unique)