Ad
  • Custom User Avatar

    You're welcome.

  • Default User Avatar

    @Chrono79: thanks for all your answers!

  • Custom User Avatar

    Yes, that's why 11 comes before 2000.

  • Default User Avatar

    Oh, I have passed! It was a bit difficult :) The only thing I don’t understand to is why the second expected test result is "11 11 2000 10003 22 123 1234000 44444444 9999"? Isn’t "2000" bigger than "11" in the case of strings? Similar to "10003 22"?

  • Custom User Avatar

    Your assumption is wrong.

    When two numbers have the same "weight", let us class them as if they were strings and not numbers: 100 is before 180 because its "weight" (1) is less than the one of 180 (9) and 180 is before 90 since, having the same "weight" (9) it comes before as a string.

    You have to sort them as strings when they have the same weight.