Dota2 Senate

In Dota2, there are two parties: Radiant and Dire. The Dota2 senate consists of senators from these parties who vote for game changes in rounds. Each senator either bans another from voting or announces victory if all voters are from the same party. Given a string representing each senator's party affiliation ('R' for Radiant and 'D' for Dire), predict the winning party once voting concludes.

Constraints

  • n == senate.length
  • 1 <= n <= 10^4
  • senate[i] is either 'R' or 'D'
Saving… · 2 lines
class Solution:
def dota2Senate(self, senate: str) -> str:
Console

Click Run to execute sample tests.