I'm looking for a little help to check my logic on this problem set.
My program currently passes all the check50 tests up until I have to lock in the pairs to the locked array.
You must lock all pairs in order (which check50 confirms mine are), up until the point that locking in the next pair would cause a loop in the votes system.
My logic is this. In order to not have a loop, there must be at least one candidate that is not beaten by any other candidate in a two candidate stand off.
Therefore, I must stop locking pairs at the point in which the loser for that pair is the final candidate that hasn't yet lost (if indeed this ever happens).
To achieve this, I first create an array of unique losing candidates ,but omit the final candidate to lose (if indeed this happens).
I then proceed to copy each pair into the array, only after having checked if the loser for that pair is in my list of 'permitted loser'. When/if I come across a loser that isn't in my list, I return to main.
I have checked through the logic of my code multiple times, and can't see an issue there.
There very well could be an issue with the code, and if so then I will just continue trying to correct it myself, but I just wanted to get some other opinions on the logic. Clearly if there is a hole in the logic then checking and re-checking my code is pointless.
Any thoughts would be much appreciated!!