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.
Its not bad.
Just remember to make your code easy to understand to others.
Also try not to repeat yourself. You are calculating 3 times the where the half is.
Instead you can make a specific variable for it at the beginning solving both of your problems.
Someone can give me feedback about my solution?
This comment is hidden because it contains spoiler information about the solution
I think your solution is way less efective, and in this top rated solution is problem with creating String s (it's redundant) we should just return new string from substring and that is it. Clear effictient and without redundancy :).
First comment I've left on this website; nice job
It's bad practice! Because every use of the substring method creates a new string. Hence we pollute the string pool. See mine....
String s is unnecessary. Just directly return word.substring(...).
This comment is hidden because it contains spoiler information about the solution
very smart
dumb af
This comment is hidden because it contains spoiler information about the solution
I just looked into it and your are right -0 is a thing however unless in string form it has no effect as 0 == -0. As well, this is only the case with floats and the desired return type is an integer. Because in java twos complete is used for integers -0 can't be created for integers.
No, no point.
Is there any point in this because 0 * (-1) == 0?