Ad
  • Custom User Avatar

    Hmmm that's weird, I'll look into it soon.

    Thanks for your report :)

  • Custom User Avatar

    It seems to me that your algorithm is flawed - you do not perform a swap every single time regardless of conditions.

    Take the list [103, 87, 113] for example:

    1. We compare the two numbers 103 and 87. Since 103 is indeed greater than 87 we perform a swap.
    2. The list now becomes [87, 103, 113] and we compare 103 and 113. We only perform a swap if the number at the left hand side (103) is greater than the number at the right hand side (113). Since that is not the case, we do not perform a swap.
    3. Therefore, after one complete pass, the list becomes [87, 103, 113].

    Hope that helps :)

  • Default User Avatar

    My solution works only on 11 examples, and on 12th:
    Input: [ 103, 87, 113 ]
    writes to me this note: ✘ Expected: [87,103,113], instead got: [87,113,103]
    Why it happens? Maybe I don't understand the task exactly?
    Working examples:
    Input: [ 25, 16, 9 ]
    Output: [16,9,25]

    Input: [ 17, 5, 11 ]
    Output: [5,11,17], etc...

  • Default User Avatar

    The output frame lights with green, but it writes that I have 1 Error, but I haven't nothing in console

  • Default User Avatar

    I agree with upper comment, check both: null and length == 0