Ad
  • Custom User Avatar

    Please spare us the input validation. Short inputs are fine, but null or invalid inputs just distract. Do one thing, and do it well. Input validation has been done.

  • Custom User Avatar

    "return -1" does not sound very idiomatic for Java. Maybe something else would be more expressive, for example OptionalInt or the Integer and null?