Ad
  • Custom User Avatar

    Got it! Where can I look for this fundamental concept? (i.e. how str(number) is ordered?, i.e. why '10003' <'22') Thanks!

    Some info can be found in Python reference, but generally it boils down to paragraph starting with:

    Sequences compare lexicographically using comparison of corresponding elements.
    [... the explanation what "lexicographical comparison" is]

  • Custom User Avatar

    As strings, '2000' comes before '11'

    How is it? '2000' is lexicographically greater than '11', isn't it? When compared as strings, 11 should come before 2000.

  • Default User Avatar

    As strings, '2000' comes before '11' and both have a weight of 2 in input "2000 10003 1234000 44444444 9999 11 11 22 123" but in answer they want '11' before '2000' and then '10003' before '22', and these logic contradicts each other!

    Could you explain how is the output correct?

    Got it! Where can I look for this fundamental concept? (i.e. how str(number) is ordered?, i.e. why '10003' <'22') Thanks!

  • Custom User Avatar

    god damit. Im stuck at 60 charachters. Its a fun experiment to keep finding ways to get it down to 52 but honestly the code wont be readable at that point.....

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    As strings, '10003' comes before '22' and both have a weight of 4.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution