Ad
  • Custom User Avatar

    Yes, you are right. Thank you for your comment.

    I'm late, now it's just rant:)

  • Custom User Avatar

    "Classic" implementation with Math.sqrt() is faster and, as YangF0917 mentioned,

    there will be still a marginal chance that the code fails to identify whether the number is prime or composite

  • Custom User Avatar

    The method which supposed to return YES or NO obviously should return boolean, not String.

    "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.

  • Custom User Avatar

    Written below refers to the variant of the kata in Java.

    The method which supposed to return YES or NO obviously should return boolean, not String.

    And the name should be at least tickets, not Tickets, 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.

  • Custom User Avatar

    "? true : false" is redundant, because the result of "i % 2 == 0" is boolean.