Send your feedback or ask for help here!
Is there some kind of trick to figuring out if something will end up looping? Because I don’t get how to solve this without some brute forcing. I get that you should keep track of the answers from the previous pairs, but on the larger number sets I get stack overflow error.
Yes, there is definitely a trick
Some of the testcases involve huge numbers and the length of the loop can be quite large so I don’t think a simple simulation could work here. This puzzle is more math than coding.
Try to figure out what specific property a and b have if they result halt. The example in the description and the other IDE test cases help a lot!
I found the solution by exploring properties of the halts. But it would be interessing for me to get the math explication for the rule.
How can i get it ?
@Rirelus I have given such an explanation in comment in the solution codes I published (in Python, Ruby & C++). If you’ve solved the problem in one of these languages, you have access to it. Otherwise, I can either publish a solution in your language or send the explanation to you in PM.
I’ve only done it Java. But doesn’t matter if i don’t have the mathematic solution …
@Rirelus Ok, I’ve just published my solution in Java.
Thx @Niako !
I did’nt have the same solution, but it’s the same relflexion.
Thx for your answer
I managed to pass all tests and almost all validations (“Random small validators” fails), which seems odd.
Although, I am using mathematical properties of halting sequences, I can’t get a 100% score. Is it possible to pass all tests, but still fail to validate a solution?
It’s possible that there is an edge case not covered in the IDE tests that you don’t handle well.
Here’s the validator:
6 6 58 1 7 15 17 16 88 48 82 21 87
halts halts halts loops loops loops
Indeed! The pair (21, 87) brings to light a corner case I didn’t account for. Challenge unlocked!
Thanks for the assist! (^_^)b