• Default User Avatar
  • Default User Avatar

    I don't understantd your answer, In my case, Matthew and Elizabeth get the same score, so it's Elizabeth's win because E is comming before M.

    In the next example, you have the same case :
    rank("Aubrey,Olivai,Abigail,Chloe,Andrew,Elizabeth", [3, 1, 4, 4, 3, 2], 4), "Abigail"), Abigail and Chloe get the same score and it's Abigail's win.

    There is something that I don't understand.

    EDIT : I'm a stupid monkey, I got it, sorry for my useless comment

  • Default User Avatar

    If you're talking about this test case → rank("Elijah,Chloe,Elizabeth,Matthew,Natalie,Jayden", [1, 3, 5, 5, 3, 6], 2), "Matthew")

    Elizabeth is indeed before Matthew but the test asks for the one in 2nd place. Hence, Matthew is the correct answer.

  • Default User Avatar

    You're right E comes before I. Here are the results of the test case you provided, sorted →

    [ 'Michael', 348 ] [ 'Robert', 336 ] [ 'Ethan', 318 ] [ 'Lily', 310 ] [ 'Benjamin', 304 ] [ 'Emily', 207 ] [ 'Isabella', 207 ] [ 'Aiden', 190 ] [ 'Logan', 162 ] ....

    Isabella is the one in 7th place so the test works just fine.
    Maybe you got something else wrong.

  • Custom User Avatar

    have you solved that issue? what is the other things to consider? in description it says that we should sort alphabetically nothing more

  • Custom User Avatar

    I have a question about last step, it says that if there is two names with same score, we should sort it by there first name,
    in case Matthew and Elizabeth, test case says that Matthew is the output, but why? E is coming first not M, and output
    should be Elizabeth, who can explain it?