Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
FYI: Please review
Move History
to understand the logic of whyn = bin(n+1)
was used to convert "n
" to binary.Originally this was based on creating an array of these values, and therefore the first value in the array would be at index 0. Index 0 being where n=1 ends up being stored.
You could definitely just rewrite the description / tests so it is directly in regards to the nth value in the sequence.
Infact rereading my description, it really is not very clear.
Regarding the variable
binaryString
, why did you add 1 toi
when convertingi
to binary?Cool, I've updated my reference solution now. Passes my tests much faster. My original was definitely very wasteful.
Thanks. Had never though about input mutation before.
As you suggested, I've made it so it calls the reference solution first.
This comment is hidden because it contains spoiler information about the solution
I think I need to check the other reachable positions even after finding a solution for boardSize, incase they lead to a more optimal solution.
I guess what I could do is cut other paths short as soon as they reach the rollNumber of the current most optimal solution.
I'll take a look at your solution, and possibly others, and hopefully learn a trick or two.
Thanks for spotting.
Its fixed now. :P
I read over it. If it's in there, it's OK. "positive" is already enough.
If I want to be lazy / clever / less maintainable in my code, it's up to me to read the specs carefully.
This is in the rules, but as a sub point, and therefore not super clear. I'll look to make it, its own rule tomorrow.
probably intends
snakesAndLadders
( plural ). it's a plural everywhere else.* its, not it's ( try saying it out loud without the contraction )
There are never snakes back to the starting position. That would be useful to know. My solution abuses this condition; I could program around it, but the code is simpler assuming it.
ETA: I see the example solution does exactly the same thing. :P
Loading more items...