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.
Okay. So, not explaining that in the rules is fine. It's on me for not looking at the sample tests. Got it.
It's just that the rules go out of their way to tell you the format can't have a trailing line, so I get it when doing so fails you.
But the rules say nothing about formatting a new line IMMEDIATELY after the last digit. You have to discern that from elsewhere. That's why I thought it was an "issue". But, I know better now.
When I see this as an example answer for 5,
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50
(no trailing empty line)
and my output is this:
1 * 5 = 5
2 * 5 = 10
3 * 5 = 15
4 * 5 = 20
5 * 5 = 25
6 * 5 = 30
7 * 5 = 35
8 * 5 = 40
9 * 5 = 45
10 * 5 = 50
(no trailing empty line)
I'm going to be confused about what's "wrong" when I fail.
So...what do I call it then when I'm abiding by all the rules, creating the right table, but still failing?
maybe let people know the \n has to come IMMEDIATELY after the line's last digit.
An extra/empty space between digit and \n isn't acceptable, though that's not stated in the rules.
At least in JavaScript,
having an empty space between the last digit and the \n will fail you.
[...answer] \n
isn't acceptable. It has to be:
[...answer]\n
Code like this is the reason I scroll through here -- code that makes me aware of new things!
Thanks, "cheater"!
Mind me asking why you prefer this to other solutions like the one-liners above?
I found the instructions rather confusing, and am offering a potential revision/clarification:
"A hero is on his way to a castle to complete his mission but the castle is surrounded by powerful dragons!
If each dragon takes 2 bullets to be defeated, does our hero have enough ammunition?
Return true if he has enough bullets to survive."
I'm brand spanking new to coding (two weeks of self-studying) and seeing stuff like this is motivational.
I love seeing the different ways people think and approach problems--and how SIMPLE some code can be because of it.
This comment is hidden because it contains spoiler information about the solution