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.
nice code but not really correct. This gives an output of [H, o, w, , c, a, n, , m, i, r, r, o, r, s, , b, e, , r, e, a, l, , i, f, , o, u, r, , e, y, e, s, , a, r, e, n, ', t, , r, e, a, l]
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?
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 :).
I had a very similar solution, though yours looks a bit more memory effective than mine. This fails case-sensitivity though ;) (even if it wasnt a rule.)
I did the same thing with a switch, I like how he extruded the comparator to its own function. I didn't even think to just use a char array for memory then convert back to a string with the return line. I used a string array. (I also haven't coded in years xD) Very elegant!
I did this but added strings to a knew string. This is more efficient
Liked how you even created a function, such an efficient code!
Pardon my ignorance but how do the two for loops ensure that the extra characters are added.
If both for loops run as many times as there are characters in the string then surely would'nt just one extra character be added.
Because both loops are running at the same time and j will only be one digit smaller than i the whole time?
I would be really greateful for any explanation
Is it possible to test the code on Eclipse?, I'm new to programming, and I can't run the code.
It's bad practice! Because every use of the substring method creates a new string. Hence we pollute the string pool. See mine....
this is art..
I prefer move the
if
outer the loop and remove prefix withit prevents execute
n-1
-sentences.Avoids memory reallocation for the String char array representation
yeah wtf haha
Loading more items...