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.
How do you guys add translation to a Kata? I can create my own ones but I'm not able to find the "+" button that is mentioned here https://github.com/Codewars/codewars.com/wiki/Tutorial:-Approving-translations
Sure it isn't work in the end. Perhaps I just put a different meaning behind the word "Best Practices" in this context.
My bad if I sounded rude but I'm afraid I still disagree. In this context it's alright like you said, it does the job. However it would never pass the green flag in an optimal working environment. Which is what the vote "Best Practices" should stand for in the end.
There are several instructions that are duplicated which make this snippet reach the threshold of what-shouldnt-be-copy-pasted.
There are countless times I said to myself: "those 3 lines in common don't deserve a new function" and ended up regretting it two days afterwards.
Code duplication is a technical debt you leave to yourself and your colleagues. When fixing a bug you don't want to have to look through all the other copy-pastes that you or somebody else have left. Copy-paste is copy-waste :)
Your function could then be as simple as "return sumString (s1) == sumString (s2);"
Original but a bit far-fetched isn't it?
There's not best practice granted here, there's obvious code duplication in this answer.
You should make a sumOfChars function so that you don't write twice the same thing.
It's not clear in the description that negative integers are a valid input. Otherwise there should be a test case for this.
I consider the answer optimal.
Technically he doesn't as the original array is passed by copy.