Problem 986. Penny Flipping: Reverse subsets of a sequence of coins until you recover the original configuration
Solution Stats
Problem Comments
-
5 Comments
I don't understand the first description. For me we obtain :
0 1 2 3 4 5 6
-------------
0 1 0 1 0 1 0
0 0 1 0 0 1 0
0 0 0 1 1 1 0
So so PF-1(3) = 6.
Did I miss something ?
Jean-Marie: I think the phrase, "invert the substack" is the issue. For me, this means to take the substack and invert it as a unit. The coins exchange positions in the substack as well as inverting their values. It is a single physical action that translates into two separate operations on the coins. I may have done better to write, "flip the substack as a unit."
Thank you Everett.
Now I understand the second operation, but not the Nth operation (in the example) when you invert all the stack. It's OK between steps 5 and 6 and between steps 8 and 9, but not between steps 2 and 3 (1 0 0 -> 0 1 1 ?).
Jean-Marie: The transformation between steps 2 and 3 (1 0 0 -> 1 1 0) is the same as for the one between steps 8 and 9; we are working with the entire stack of 3 coins. The first/top coin exchanges with the last/bottom coin and then all coins change their orientation.
Every i-th step, imagine that we are picking the top i-coins with our fingers and fliping them upside down. That's FP-1. FP-2 does similar, but, instead of always picking the top i-coins, it alternates between top i-coins and bottom i+1-coins.
Solution Comments
Show commentsProblem Recent Solvers12
Suggested Problems
-
Find common elements in matrix rows
2291 Solvers
-
16683 Solvers
-
Omit columns averages from a matrix
567 Solvers
-
Rounding off numbers to n decimals
3339 Solvers
-
96 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!