Problem 44715. 007: Chinese Barrack Invasion
MISSION: Successfully invade a military barrack located in China.
WARNING: There is a row of n security switches protecting the military installation entrance. The switches can be manipulated as follows:
- The rightmost switch may be turned on or off at will.
- Any other switch may be turned on or off only if the switch to its immediate right is on and all the other switches to its right, if any, are off.
- Only one switch may be toggled at a time.
All n security switches are currently turned on. Deactivate the security system by turning off all the switches in the minimum number of moves m (toggling one switch is considered one move.) An alarm will be triggered if more than m moves are made. Quickly, determine the minimum number of moves m .
Be Careful. Do not get caught!!!
HINT: The security system was designed by the Chinese.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers22
Suggested Problems
-
Return a list sorted by number of occurrences
2776 Solvers
-
Extract leading non-zero digit
2134 Solvers
-
Find the largest value in the 3D matrix
1521 Solvers
-
Convert a vector into a number
599 Solvers
-
559 Solvers
More from this Author18
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!