Ad
  • Default User Avatar

    Seems that this solution is not completely correct, as if the array is not sorted, but the First element = Min/Max and the Last element = Max/Min, the result will be incorrect, e.g. new [] {1, 2, 4, 3, 5, 6, 7, 6, 8}, it returns - "yes, ascending", while the array is not sorted.