Skip to main content
All Questions

A lock has a three-digit code, and each guess tells you only whether at least one digit is in the right position. How do you find the code in as few guesses as possible?

Unlock detailed company stats for this questionUpgrade
A lock has a three-digit code. When you enter a three-digit guess, you are told only whether at least one digit is in the correct position. Design a strategy that finds the code in as few guesses as possible.

Community answers

No answers contributed by the community yet.

Related courses

Course

SQL Interview Prep Course

Prepare for SQL interviews with lessons on joins, aggregations, and window functions, then practice real SQL interview questions in an interactive editor with expert solutions.

Course

Data Science Interview Prep

Land your dream data science role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates. Practice statistics, experimentation, coding, SQL, machine learning, behavioral interviews, and more.