Ad
  • Default User Avatar

    Need a test case like the following: {9,10,14,12,13}
    This case would fail several of the accepted answers because they check for more than one instance of prev > current as a fail condition.

  • Default User Avatar

    Thinking there should be a test case where n is 0. A lot of the solutions that don't convert n to a String will throw an exception if 0 is passed in because we try to Integer.parseInt an empty string.

  • Default User Avatar

    What happens if n is 0?
    I'm thinking parseInt("") is going to throw a conniption fit!