This is All the Way to the Top , which can be solved using brute-force since there are only possibilities.
What's the minimum number of clicks Alice needs to check all possibilities?
Bonus: Find the clicking sequnce.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
We can code the state of each input as 0 for "off" and 1 for "on". A particular combination is then represented in binary by a number in the range [ 0 , 2 n − 1 ] , where there are n input boxes ( 5 in the case of this problem).
Since there are 2 n states, and we start in a given state, the best we can possibly do is 2 n − 1 clicks; but is this possible?
Let's start with a simpler case: n = 2 . The four states are 0 0 , 0 1 , 1 0 , 1 1 ; but this ordering doesn't work (at one point we change two bits). But reordering to 0 0 → 0 1 → 1 1 → 1 0 does work.
If we think about the two bits as coordinates, the four points form the vertices of a square. "Clicking" moves us along an edge of this square.
So we need to find a path around a square that visits every vertex exactly once by travelling along edges.
This is easy for n = 2 ; the path we found above has this shape: ⊐
Now let's try n = 3 . Here the points we have to visit form a cube; again, clicking corresponds to moving along an edge. This is a bit harder to picture (but worth trying), but we can solve this with the n = 2 solution. Split the cube into two parallel squares; the path we'll take will visit the four vertices of the first square, then jump to the second square, and visit those four vertices. The path we get is 0 0 0 → 0 0 1 → 0 1 1 → 0 1 0 → 1 1 0 → 1 0 0 → 1 0 1 → 1 1 1
Note that, as required, we only click one box each time. Also, there are various points we can make a choice about the path; but we only have to find one solution.
We can continue this idea for larger n ; a 4 -d hypercube can be thought of as two parallel cubes; a 5 -d hypercube is two parallel 4 -d hypercubes.
An explicit example for n = 5 using this approach is below: → → → 0 0 0 0 0 → 0 0 0 0 1 → 0 0 0 1 1 → 0 0 0 1 0 → 0 0 1 1 0 → 0 0 1 0 0 → 0 0 1 0 1 → 0 0 1 1 1 0 1 1 1 1 → 0 1 1 0 1 → 0 1 1 0 0 → 0 1 1 1 0 → 0 1 0 1 0 → 0 1 0 1 1 → 0 1 0 0 1 → 0 1 0 0 0 1 0 0 0 0 → 1 0 0 0 1 → 1 0 0 1 1 → 1 0 0 1 0 → 1 0 1 1 0 → 1 0 1 0 0 → 1 0 1 0 1 → 1 0 1 1 1 1 1 1 1 1 → 1 1 1 0 1 → 1 1 0 0 0 → 1 1 1 1 0 → 1 1 0 1 0 → 1 1 0 1 1 → 1 1 0 0 1 → 1 1 0 0 0
(each row above corresponds to visiting the vertices of a cubic cell of the 5 -d hypercube)