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.
"Hey, clean code! Just a heads-up — if someone enters zero or negative values, this code still returns surface area and volume, which may not be realistic. Adding input validation could make it more realistic.
Ah, I could have simplified my solution. Oh, well.
This comment is hidden because it contains spoiler information about the solution
thanks! i simply forgot about it
It is not specified that
haystack
does not containsnull
's. In case ofnull
String#valueOf
will throw aNullPointerException
. Pretty elegant solution though!