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.
It's generally advised to use
while (true)
, instead offor (;;)
in PHP.It's not clear how you would speed it up, can you show an example of what you mean? (don't forget to mark it as a spoiler)
Do you mean to say this can't be done in PHP?
Because the fact that it's available in PHP tells us that it has been implemented in PHP, there are pre-determined and random unit tests in PHP, and that those have been completed.
The parentheses are not necessary, as you do the modulo first already.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It doesn't have to be, and this is up to every programmer's preference.
The Ruby Style Guide does suggest putting method names in
snake_case
, but this is only a suggestion.This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
You can type your code into the top-right textbox. You can press Ctrl+' to test your code. You can press Ctrl+Enter to attempt sending in your solution. If it passes all tests, including random ones, you can press Ctrl+Enter again to upload your solution.
If you wrote your code somewhere else, you can copy the text and paste it into the top-right textbox.
If there's still any confusion, just reply your question to my comment!
The line
return "" if words.empty?
is completely redundant here, as[].join(" ")
returns the same thing.It's a nice touch, but why include it if it essentially does nothing, right?