Ad
  • Custom User Avatar

    I agree it's not very original.
    To make it more challenging, you might replace int with BigInteger and test for bigger numbers.
    Int will become too small very quickly for fibonacci.
    Also the calculation method will become much more important the larger the number is.
    If you use recursion without memoization the processing time will quickly become too slow for codewars.
    And the kata more challenging.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    That's true. I just did not find any simple working version for Java, wanted to practice here at CodeWars.

  • Custom User Avatar

    This kata has been done too many times in varying ways. It just isn't original.

  • Custom User Avatar

    You are right. Thanks for the catch!

  • Custom User Avatar

    IllegalStateException

    Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation.

    It should probably be IllegalArgumentException.