Problem 1189. Knights and Knaves (part 3)
Solution Stats
Problem Comments
-
4 Comments
If the guard is a knave, and I ask him what the password is, what response do I get? Do I still get an array of chars? Does he replace 'A' with 'Z', 'B' with 'Y', etc..?
questions can only be statements that evaluate to a scalar logical value (yes/no questions), so you can ask things like QUESTION('PASSWORD(1)==''A'''); or QUESTION('strcmp(PASSWORD,''ASDF'')'); but if you ask a question that returns a vector you will simply get an error.
Very fun problem Thanks!
Thank you for taking the time to make up this series of problems.
Solution Comments
-
2 Comments
Islander Code injection :)
Shame on you, LY Cao, for that hack. :)
-
1 Comment
Nice way to minimize number of queries!
Problem Recent Solvers31
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
43979 Solvers
-
153 Solvers
-
Arrange vector in ascending order
727 Solvers
-
631 Solvers
-
Convert a Cell Array into an Array
1170 Solvers
More from this Author38
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!