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.
Random Tests, as the name, where test cases are generated randomly on the fly.
So that it can prevent hardcoded solutions.
thank you for all your comments.
what do you mean?
omg. it should be just simple kata for beginers. People who know such approaches should not even look to this kata. But you are right. I had to try harder :)
yes, you are right. I missed it.
If you try to make a kata with restrictions, you need to do hard, harder, even harder
And you did not even try to ban
for
orwhile
.Are they not loops to you?
Use
Test.assertEquals(actual, expected[, message])
instead ofTest.expect
to provide friendly debug message.Needs Random Tests.
Sum the input has been done millions of times, and nope, adding restrictions does not make it different.
I'd say it's pretty readable, except that maybe the logic can be extracted out to a separate function.
Now I really wouldn't want people to use tons of for loops and if conditionals for this, or otherwise the code length itself is making the readability suffer a lot! :P
it's CW not a production;P it should train your brain.
very nice solution.
but what about code readability?