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 probaby because you can get the same number as
int
,long
,string
or whatnot. Check it withConsole.WriteLine(n.GetType())
to know for sure.Shouldn't the first line have index on
first_name + last_name
andlast_name + first_name
instead of 2 timesfirst_name + last_name
?Accidentally submitted. This one may fail or succeed randomly, i was trying to understand why it was random and hit submit instead of attempt.
(The cause turned out to be negative indices that should be treated as positive indices, something that wasn't even mentioned in the description or initial tests).
Oh right, i can print that, i forgor 💀.
My regex is wrong, i know it, i just couldn't figure out why it was failing one of the tests. Now that i printed it, i see that it was the test for 253 total characters limit (and that it's not 7th, it's #8 out of 10 length tests...).
Thanks for the assist.
Fix:
https://www.codewars.com/kumite/64b45a832067442d2333832f
Not sure what you're asking, do you mean which rule are you getting wrong? Which test is the seventh test? Easier for people to answer you if you show the output and argue for why it should be your answer instead of the one the test wants. Or if you're wondering what the input was, then I mean ask what the input was, but, you can print that. All around I'm really confused.
My solution [python] is passing all of the tests except one and i have no idea what is wrong because all it says is "value is not what was expected". But what was expected? I only know it's something about length, but i already tried every "missed by one" possible errors and no luck.
What does the 7th test in the length group test for?
This comment is hidden because it contains spoiler information about the solution
Oops, you are right.
Changed the name back to
s
in solution setup and in description.string
hides a stardard module and should not be used as parameter name.I agree Clever flag is more appropriate. But this shows again that Best Practise and Clever don't mean that much. Perhaps a single Upvote button is better.
I disagree. Using a system function to cast the number to string, when bit operations can be used to determine if a bit is set (which is the whole purpose of these operators), is using a rocket launcher to me. The count operation additionally has to view every element.
Bitwise checks are mostly done, where performance has to be considered. This is why I disagree on this solution being best practice for this particular task.
Besides, if you'd found this line of code, without the method name, most folks would still not recognize that it counts bits.
Don't get me entirely wrong, I still think this solution is creative, since is solves the task with minimal effort. I just can't agree on this being best practice.
This is not less rocket launcher than your solution (and not really more than any other one).
I'm not sure why so many think this is elegant and considered to be a best practice.
You should not shoot with rocket launchers at birds.
For all discussing performance over readability... Usually, the piece of highly optimized code is never read nor changed after it works. One may hide it somewhere in a helpers folder and you ain't gonna see it. So it depends on what you need.
Loading more items...