Google Onsite L5 || Coding round 2

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2024-10-23Added By Anonymous
Source: Link

Company: Google
Role: L5
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

There is a list of N ~1000 objects (can be whatever: dog, cat, house, tree, etc.).
There is a list of M ~1000 additional binary features ("is it green", "is it a living thing", "does it have four legs"...).

There is a NxM table providing the value of each feature for each object.

                      cat,    dog,  tree  chair
it is green           1.     0.     1     0
is it a living.       1.     1.     1.    0
does it have 4 legs.  1.     1.     0.    1
xyz                   1      0      0.    0
+

is it a cat           1       0     1     0


Objective: give minimum no of binary questions we can ask to determine the answer.
In the beginning we don't know what the user has guessed.

Human.isGuessCorrect(String s) - true or false

is it a living, does it have 4 legs, it is green - 3 step
does it have 4 legs, it is green - 2 step

No idea how to approach this. Bombed this round.

Comments