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.
You are right. We don't need the "else" statment because the previous "returns". Also, the other friend is right too, the right way to compare string (motivations of this in other answer here) is using the .equals(). I adjusted my solution.
Also I don't like "if" clausules without curly braces, although the code will have more lines. More clear is better. I adjusted the spacements too :)
Thank you guys!
It's good solution, but why have you written else statement in the end? Programm will go to command return "green", only if current state wasn't "yellow" or "red".
Just solved in C# as well. All looks up and up.
Ah I see thank you for explaining it and fixing it. So me using pop() was the problem. I'll keep it in mind that some problems may not play well with mutating an array.
@SinisterSup, your solution supposed to stop when you get exactly on the final square (not paying attention to the snakes/ladders it has), i.e. if on the next turn you get exactly on the final square, you has to return it, ignoring the value of that square (0, snakes or ladders).
Your code, however, doesn't stop after reaching it, and continues the turns.
"exhausted" means "the array has become empty, and then that empty array has been used for the next test case, although it was supposed to be the same as before the first test".
Even I'm facing the same issue with broken go tests, (11/100), (53/100), (56/100) and (77/100) numbered test are throwing very similar errors, though my code is working properly.
Hmm, but I failed the same test case where I was just modifying the board by updating our position in it with an "x". I assumed to solve this we'd need to update one of the parameters... but I suppose that only matters if you're doing it recursively. I coulda just tracked my position with a variable and a while loop or something and it probably woulda been simpler.
What did you mean by 'exhausted' though.
The reason why your solution didn't pass is because you modified the input array
dice
, so after the first test in the section it was exhausted.Thanks for noting that out, I changed the tests so they won't be modified after each function call, now your solution should pass.
This comment is hidden because it contains spoiler information about the solution
It says <= so both are included.
This comment is hidden because it contains spoiler information about the solution
Very fun. I encourage more people to try this one!
it's 'another' game, nobody wants to win
I think some might be confused if they think in terms of who should win. Solve it as if Frank is having his best day ever and the other two are playing while distracted (probably solving Kata or something).
Loading more items...