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.
perfect examples of a simple problem solved with something that is really not worth trying to understand
Wouldn't this convert the full array to list first and then provide index of match?
why traverse through full array, when we can "return" upon finding the "needle" with a simple for loop, thoughts?
Nice
Is the type casting necessary or best practices?
Someone can give me feedback about my solution?
This comment is hidden because it contains spoiler information about the solution
I used toString() too, but realized I didn't have to. Thanks
Super clever OOPified solution :)
Forgot about a booby trap - dividing null))) With the "for"-loop everything is ok!
make sure you check that n!=0, otherwise you will have an endless loop that would cause the timeout. otherwise, idk either
I wrote same code, but for some reason server timed out, IDK
Doesn't work if input parameter haystack=null. Need to add checking for null input.
The only thing different I'd do here is make the 48 a descriptive constant to avoid it being a magic number. I'd make the constant follow what @boyarkogc explains is the reason why 48 is there. I.e. CHAR_TO_INT_CONVERSTION_NUMBER or something better.
OMG!Wasted so much time and didn't even think about it! Very clever solution!
There is no point in using new String() here. I think you can just leave it away.
Loading more items...