Could a constraint solver just rip through this problem?
Here's a puzzle game. I call it Reverse the List of Integers
51–60 of 188 posts
Re: Here's a puzzle game. I call it Reverse the List of Integers
#52It's not possible in general, e.g. [3, 2, 1] can't be reversed.
Re: Here's a puzzle game. I call it Reverse the List of Integers
#53I thought the game was cool so I built a little version of it here: https://blaise.gg/number_game/index.html
Re: Here's a puzzle game. I call it Reverse the List of Integers
#54Re: Here's a puzzle game. I call it Reverse the List of Integers
#55Coming soon to a coding interview near you!
It would 100% fit in with the interviews I've had in the past year.
Re: Here's a puzzle game. I call it Reverse the List of Integers
#56Coming soon to a coding interview near you!
Re: Here's a puzzle game. I call it Reverse the List of Integers
#57Earlier quoted context omitted.
Yeah, the problem is slightly underspecified, though it’s pretty obvious that you’re not allowed to do swaps as that obviously makes the problem trivial.
Not trivial - I do not see how to solve [3, 2, 1] without this kind of swapping. Perhaps we need to clarify the rules for a starting point first.
Re: Here's a puzzle game. I call it Reverse the List of Integers
#58It's not possible in general, e.g. [3, 2, 1] can't be reversed.
Re: Here's a puzzle game. I call it Reverse the List of Integers
#59This can be transformed into a problem with pegs and moving blocks. 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. Unless you want to deal with negative integers, then it would get more tricky. [1]: https://en.m.wikipedia.org/wiki/Tower_of_Hanoi
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.
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.
Re: Here's a puzzle game. I call it Reverse the List of Integers
#60Coming soon to a coding interview near you!