Good Processor

You are on a spaceship that has a computer with n processors.
Suddenly, the spaceship gets hit with an alien laser beam, and some of the processors are damaged.
However, you know that more than half of the processors are still good.

You can ask one processor whether it thinks another processor is good or bad. A good processor will always tell the truth, but a bad one will always lie.

A ‘step’ consists of asking one processor if it thinks another processor is good or bad. Find minimum number of steps required to find at least one good processor.

Answer is a integer. Just put the number without any decimal places if its an integer. If the answer is Infinity, output Infinity.

Feel free to get in touch with us if you have any questions

Hints
  • Solution Approach
  • Complete Solution
3278 successful submissions.
Click here to jump start your coding interview preparation