Dota2 Senate

Given a string representing senators from the Radiant and Dire parties, simulate the banning process until one party wins. The party whose senators can act earlier in the round should use the heap-like scheduling of indices to stay ahead.

Input Format

senate = party sequence

Output Format

winning party name: 'Radiant' or 'Dire'

Constraints

  • 1 <= senate.length <= 10^5
  • senate consists only of 'R' and 'D'

Examples

Example 1:

Input:

senate = "RD"

Output:

Radiant

Explanation:

Radiant acts first and bans Dire.

Example 2:

Input:

senate = "RDD"

Output:

Dire

Explanation:

Dire eventually has the surviving senator.

Loading...
Dota2 Senate - Heap DSA Problem