Pergunta de entrevista da empresa Microsoft

I had a programming question about sorting balls to find the lightest or heaviest one. Blanked on using a base case which really hurt my chances.