Google Onsite L5 || Coding round 2

Anonymous User
786
Oct 23, 2024
Oct 23, 2024

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 has 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 beginning we dont know that what user has gueessed

Human.isGuessCorrect(String s) - true or false

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

No idea, how to approach this.Bombed this round.

Comments (7)