649. Dota2 Senate
Practice Dota2 Senate for free on NudgeCode: Medium, Greedy pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Each character of senate is a senator from party R (Radiant) or D (Dire). Senators act in order, round after round, skipping anyone who has been banned. On their turn a senator may ban one senator of the other party. As soon as every remaining senator belongs to the same party, that party wins. Assuming everyone plays their best, return "Radiant" or "Dire".
Example
senate = "RD" -> "Radiant"
senate = "RDD" -> "Dire"
Constraints
- 1 <= senate.length <= 10^4
- senate[i] is 'R' or 'D'