Participate in Codex, Test Your Skills & Win BIG

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

  • Solution Approach
  • Complete Solution


Click here to start solving coding interview questions