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.
Yes, you are right. Thank you for your comment.
I'm late, now it's just rant:)
"Classic" implementation with
Math.sqrt()
is faster and, as YangF0917 mentioned,"YES"
and"NO"
are strings, not booleans, and all other languages have the same output, so, no, it won't be changed now. All solutions would be rendered invalid if changed.The name of the function, it could be changed, but with care, again, so not all previous solutions become invalid.
I think your issue (maybe suggestion would be better in this case), while it has some valid points, should have been raised before the kata was published, now it seems too late.
Written below refers to the variant of the kata in Java.
The method which supposed to return YES or NO obviously should return
boolean
, notString
.And the name should be at least
tickets
, notTickets
, according to the Java method naming convention.But even
tickets
is bad name, because it tells nothing about what this method is supposed to do.Something with signature like
public static boolean isPossibleToSellTicketsToTheEntireLine(int[] billsInTheLine)
would be much better."? true : false" is redundant, because the result of "i % 2 == 0" is boolean.