Live data from Hacker News

Here's a puzzle game. I call it Reverse the List of Integers

mathstodon.xyz

111–120 of 188 posts

Re: Here's a puzzle game. I call it Reverse the List of Integers

#111
post #97
post #95

Earlier quoted context omitted.

Couldn't you split 3 into [4,-1] ?

None of the implementations support negative numbers, but the rules say integer which includes negative numbers, so that should be a legal move.

They also say that a given integer should be split into two smaller integers.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#112
post #61
post #25

This 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

The charm of towers of Hanoi is that you can make a physical version where the legality of moves is easily verified because of the differently sized blocks. I think the “you cannot have towers with the same amount of blocks” rule will make this a lot less charming, certainly if any of the numbers are larger than, say, 10. There also is the issue of adding pegs, but that’s solvable by fixing the number of stacks (the…

You can make a physical version by having one fixed height pole for each integer up to the max, and then an equal number of post holes. Eg. If you wanted to support a game up to the integer 10 you would need 10 posts with lengths from 1 to 10 units, and 10 post holes.

The biggest issue with this game is that there's no guarantee that any arbitrary starting state has a valid solution. A much needed improved would be a simple rule for guaranteed reversible starting formations (if one even exists).

Re: Here's a puzzle game. I call it Reverse the List of Integers

#114
My first reaction to this was, "neat coding question for interviews". I started to try to solve it for a few seconds, then thought of when I've asked coding questions. Invariably starting by saying "The goal is to see how you approach and work through the problem, and less so whether you come up with the optimal solution". Then I thought, what if the interviewer and interviewee tackled the problem together, both coming in cold? And that was stated as such, up front? It would be much closer to the real world of tacking novel problems as a team. Taking the pressure of "I need to come up with the answer" off the interviewee should result in real focus on "working through the problem", and decrease interviewee stress; if the interviewer doesn't know the answer yet, how can they expect the interviewee to come up with one?

There are a couple of obvious downsides like: What if it turns out the problem is too trivial? Move on to the next one. What if the interviewee has already encountered the problem before? No different than if the interviewer posed an already-solved problem.

It would be incumbent upon the interviewer to not reveal a solution if they come up with it first of course. And the evaluation of "how you approach and work through the problem" is less definite than whether an answer (brute-force or optimal) was achieved; but if approach is indeed the important thing, that needs to be evaluated regardless. I'm sure there are other downsides I'm not seeing off the top of my head.

I can't be the first person to come up with this strategy, nor try it in real interviews. Has anybody attempted this? Was it successful or not, and why?

I can't tell if this strategy that just popped into my head is of value :-).

Re: Here's a puzzle game. I call it Reverse the List of Integers

#115

the best I can find for [7, 5, 3] is: 7 5 3 7 1 4 3 2 5 1 4 3 2 5 1 7 2 6 7 2 1 5 7 3 5 7

The following should be all the smallest solutions for [7, 5, 3]:

753 7512 34512 3462 34152 3417 357

753 7512 762 7152 34152 3417 357

753 7512 762 3462 34152 3417 357

753 7143 25143 2643 21543 2157 357

753 7143 25143 2643 267 2157 357

753 7143 25143 2517 267 2157 357

Discovered using SAT/SMT

Re: Here's a puzzle game. I call it Reverse the List of Integers

#116

Hi. I'm the post's author. This was something I dashed off quickly, so I was a bit imprecise in the language. Clarifications: Only positive integers are meant to be allowed. (Zero excluded.) Combining is meant to work on adjacent pairs of integers. If this is used in coding interviews, I deny any responsibility. Unless it's used in interviewing me, in which case I will totally take credit.

Should we assume the numbers are initially positive and distinct, too?

Re: Here's a puzzle game. I call it Reverse the List of Integers

#117

My first reaction to this was, "neat coding question for interviews". I started to try to solve it for a few seconds, then thought of when I've asked coding questions. Invariably starting by saying "The goal is to see how you approach and work through the problem, and less so whether you come up with the optimal solution". Then I thought, what if the interviewer and interviewee tackled the problem together, both comi…

what if we just interviewed people.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#118
post #27

Earlier quoted context omitted.

To be pedantic, this isn't the operation he gave - "split an integer into 2 smaller integers" is the operation, but 2 into [3, -1] is splitting it into a larger and smaller integer. Read literally, the numbers are constrained to not jump over the 0. It might depend on interpretation (absolute value or distance from positive infinity?); but negatives are tricky to handle with these rules and I think they might be ille…

> To be pedantic, I don't think that's pedantry. That's just a straightforward reading of the rules, and I missed the word "smaller", somehow. *shrug*

Are you being pedantic about pedantry?

Re: Here's a puzzle game. I call it Reverse the List of Integers

#119
post #61

Earlier quoted context omitted.

The charm of towers of Hanoi is that you can make a physical version where the legality of moves is easily verified because of the differently sized blocks. I think the “you cannot have towers with the same amount of blocks” rule will make this a lot less charming, certainly if any of the numbers are larger than, say, 10. There also is the issue of adding pegs, but that’s solvable by fixing the number of stacks (the…

You can make a physical version by having one fixed height pole for each integer up to the max, and then an equal number of post holes. Eg. If you wanted to support a game up to the integer 10 you would need 10 posts with lengths from 1 to 10 units, and 10 post holes. The biggest issue with this game is that there's no guarantee that any arbitrary starting state has a valid solution. A much needed improved would be a…

Post holes are useless, because you can split left and then split back to the right. So all you need are the n tokens.

Hanoi isn't a good model for this, because the posts are not fixed in place and the units are all identical.

It's a bad physical game because the player has to do all the work to enforce the rules. The environment doesn't provide any useful assistance.

Re: Here's a puzzle game. I call it Reverse the List of Integers

#120

The rules for operation 2 didn't mention that two integers need to be next to each other (vise versa for operation 1). Is it a requirement?

I think it's indirectly indicated by using the word "split".

When I split an atom, The pieces go pretty far apart
Post reply on HN