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.
This comment is hidden because it contains spoiler information about the solution
What the... I neet to drown myself by stuffing my head into toilet..
Yes
super helpful thanks!
Genius!
I feel so stupid now than I'm going to drown myself by stuffing my head into the toilet. See you on the other side...
you did not see my solution)))))
This comment is hidden because it contains spoiler information about the solution
Sure it isn't work in the end. Perhaps I just put a different meaning behind the word "Best Practices" in this context.
Not trying to be rude, but this isn't work. Getting a working solution out fast is what flys in competitive programming. I got the solution out fast and didn't think about refactoring code to make things more extensible - for future use.
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);"
If you haven't noticed already, this Kata cannot be editted. Also making an extra function doesn't really mean much in this scenario....
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.
Yes, you're correct. At the time of writing this Kata I did not read the problem carefully enough - a nasty habit of mine. I can't edit this solution, and haven't the need for re-practicing this Kata. I guess this Kata and your, and my comments can be a learning experience for other's.
if (s1.empty() || s2.empty())
return true;
why this check is true always? according to the task - "AA","" is false, isn't it? but "z1","" is true.
Thank you!
Loading more items...