Skip to content

Practice Dota2 Senate

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#649
LeetCode Problem

Dota2 Senate

Problem Statement

senate lists Radiant senators as R and Dire senators as D in turn order. Rounds repeat from left to right, skipping senators who have been banned. On a turn, a senator may permanently remove another senator's voting rights, or declare victory when every remaining senator belongs to the same party. Assuming optimal choices for each party, return Radiant or Dire for the eventual winner.

Source: Dota2 Senate on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
senate = "RD"
Output
"Radiant"

# Example 2

Input
senate = "RDD"
Output
"Dire"

Constraints

n == senate.length
1 <= n <= 10^4
senate[i] is either 'R' or 'D'.

Related LeetCode Problems

Practice more problems similar to Dota2 Senate.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.