3 ms·
Was just thinking this. There’s some differences, like the integers don’t have to be ordered biggest to smallest at any time, but it very much feels like Towers
by seventytwo 2y ago
Was just thinking this. There’s some differences, like the integers don’t have to be ordered biggest to smallest at any time, but it very much feels like Towers of Hanoi would be a good starting place to solve this.
- thaumasiotes 2y agoNo, not at all. In a Towers of Hanoi model, this is a completely trivial game. You'd reverse [7, 5, 3] by picking four discs off the first peg and putting them back down on the third peg. The rules here only allow you to move stuff a single peg away from its origin.
- GilbertErik 2y agoIn Towers of Hanoi, you're only allowed to pick up one disc at a time, so it's not completely trivial. It's simply operation intensive... kinda like Reverse the List of Integers [1] https://en.wikipedia.org/wiki/Tower_of_Hanoi https://en.wikipedia.org/wiki/Tower_of_Hanoi
- tczMUFlmoNk 2y agoThey're not suggesting picking up multiple discs at a time: [3,2,1][][] => [3,2][][1] => [3][][1,2] => [][][1,2,3] In effect, they're just observing that the algorithm "while x := A.pop(): B.push(x)" reverses A onto B.
- thaumasiotes 2y agoOf course I'm suggesting picking up multiple discs at a time. That's the whole idea. Compare thih9's comment: > Like tower of hanoi[1], but you can add or remove empty pegs, blocks are the same size and can be stacked in any order, you can move as many blocks as you want and you cannot have towers with the same amount of blocks. All my comment did was to point out that this description doesn't work, because the rules here are not similar to the rules of Towers of Hanoi. Under the rules of the original comment, here's how you reverse the list [7, 5, 3]: +++++++ +++++ +++ +++(----) +++++ +++(++++) It's a simple, one-step process, and this will be true for any list of three integers. A list of four or five will take two steps, a list of six or seven will take three, etc. In all cases, reversing the list is completely trivial, because thih9 introduced a rule, allowing you to simply swap two numbers, that isn't present in the original ruleset.