Ad
  • Custom User Avatar

    The test is correct; see jmeek's comment above.

  • Custom User Avatar

    I had the same problem with that particular test.... Based on the parameters given, the test appaers to be faulty.

  • Custom User Avatar

    :c doesn't appear in the first round at all, thus, you may end up not even keeping track of its votes. Thus, you should make sure you count the votes for all candidates even if they don't appear in the first round. Anything not appearing in the first round should be removed, anyway.

  • Custom User Avatar

    Apparently, the logic is that your algorithm is supposed to collect the names of all candidates before checking vote totals. Therefore :c would have been eliminated in the first round because :c recieved 0 votes.

  • Custom User Avatar

    Yes, I can imagine I misinterpreted the instructions, but I don't think I did. Others code warriors here think the last test is incorrect.

  • Custom User Avatar

    same to you...

  • Custom User Avatar

    same issue here

  • Custom User Avatar

    Got the same issue, though my elimination technique differs.

    Hard to figure out whether or not i misinterpreted the instructions.

  • Custom User Avatar

    Yep, I got the same thing. Faulty test?

    [ [ 'a', 'c', 'b', 'd', 'e' ],
    [ 'd', 'c', 'a', 'b', 'e' ],
    [ 'e', 'b', 'd', 'a', 'c' ],
    [ 'e', 'a', 'b', 'c', 'd' ],
    [ 'b', 'c', 'e', 'a', 'd' ] ]

    a, d, and b are eliminated, and c moves up in each row:

    [ [ 'c', 'b', 'd', 'e' ],
    [ 'c', 'a', 'b', 'e' ],
    [ 'e', 'b', 'd', 'a', 'c' ],
    [ 'e', 'a', 'b', 'c', 'd' ],
    [ 'c', 'e', 'a', 'd' ] ]

    c now has > 50% of the votes, but the test fails with:

    Expected: e, instead got: c

  • Custom User Avatar

    Thanks for that Kata. Quite simple, but good to learn this.

  • Custom User Avatar

    Ah, oops! OK, I've amended that test case so it should work both ways. Thank you!

  • Custom User Avatar

    The current solutions were invalidated anyway on the "should render the leaderboard with a subset of users" test - the leaderboard variable still contains all 100 names.

  • Custom User Avatar

    Great point, that's a much better way to do it! I've updated the example test cases and test cases to use your suggested tests. I've also kept the leaderboard array preloaded so current solutions won't be invalidated, but hopefully people will use your way going forward. Thank you! =)

  • Custom User Avatar

    Thank you for the feedback! I've updated the comments so hopefully they're a little more clear now.

  • Custom User Avatar

    Oops! Maybe I was thinking that I want you to also desire making the anchor tag. More likely I should just proofread better =). Thanks!

  • Loading more items...