Nice solution John! I tried this one and was quite a bit less elegant.
Done, let me know what you think.
Description should be more clear that we are looking for the next closest city in the route.
Done, thanks for the feedback, Matt.
Needs random test cases :(
Ruby Translation kumited.
I have spent on and off 3-4 hours on this problem. I MUST GET IT SOON!
"Any set/del after an undo should disallow new undos".. As email@example.com points out, should it be "Any set/del after an undo should disallow new redos"?
Thanks! I'm glad you enjoyed it. It's always great to have that "Aha!" moment :)
Nice Kata, Mike. I started out really poorly with some nested loops, but soon found the solution when the pattern became apparent.
I cringed a little at my lack of comprehension there. Cheers man, thanks for the good Kata.
You can use console.log to print the arguments to your function. That way, you can find out what the input was when your function failed.
My guess is that your program thinks 1 is a prime.
Hey there. My unsubmitted solution works for every test except a single (1/111) random one. The test expects false, but instead gets a true. It happens every time I attempt to submit.
If there's some edge case I'm missing, what might that be?
[21, 27] is not a sexy prime pair because neither is prime... 21 is divisible by 3 and 7...27 is divisible by 3, 9, and 7
[16, 22] is not a sexy prime pair because, again, neither is prime...16 is divisible by 2, 4, and 8...22 is divisible by 2 and 11
Hence, your function should indeed return false because they are not prime. As the description says: "Sexy primes are pairs of TWO PRIMES that are 6 apart".
This comment is hidden because it contains spoiler information about the solution