This is better than mine 😲
I've only gotten started with Haskell and didn't know that notElem existed... Wow 😲
Poetry, wow. Thanks for this gem.
can someone help me please, my solution passed the basic tests but in the random tests i get "execution timed out" please give me some tips,
Nice kata, although I struggled a bit with:
Rules don't mention that candidates that got no first-preference votes at all should be removed from the ballot as well. Thanks to those who pointed it out here.
You always work with first-preference votes. "...find the candidate who got the least votes and remove them from each person's voting list. In case of a tie for least, remove all of the tying candidates..." means find the candidate(s) who got the least votes AMONG FIRST-PLACERS. My mistake at first was to think that I should check the last places on each voter's ballot.
@benzrf You should atleast mention how to handle the same in the description.
I wanted to fix this kata, but I've no clue how to handle this.
"Lex Luthor" got no votes in the first round, so he's the one to be removed, not the other 4 candidates.
My code passes all test cases except [['e', 'c', 'a', 'b', 'd'], ['e', 'a', 'b', 'd', 'c'], ['d', 'b', 'e', 'c', 'a'], ['a', 'c', 'e', 'b', 'd'], ['e', 'd', 'a', 'c', 'b']]. Code returns 'e' in my ide and on the site (if I print it before returning it), but the test says "Expected 'e', got 'c'" no matter what. To prove this was the case, I even uploaded this particular test into the function and set "if voters == (this test case): return 'e'" and even then it won't pass. I have 59/60, but this one won't go through. Seems to be an issue unless I'm missing something. I can provide screenshot for proof.
Yeah I had to find that later on by looking at other comments.
This should really be more explicity in the instructions.
This comment is hidden because it contains spoiler information about the solution
[['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']]
The rules states that if their is a tie for least, eliminate all the tying candidates.
so in the first round:
there's a tie for least and I eliminated all the tying candidates;
Then second round would be
So c would be the winner. But it says it should be e. What gives???
I have the same issue, when I copy it into IDLE and run it with the same input as the test it comes back 'ind' but it's getting None in the test. (It's getting None for both tests but None is correct for the other one.)
I got this error (only) on random tests
Expected: undefined, instead got: 'undefined'
return undefined; and return;