The senate of the Dota2 world has senators from two parties, Radiant (`R`) and Dire (`D`). Voting runs in rounds, in seat order. On their turn, a senator who still has rights may either ban one other senator, who then loses every right in this and all later rounds, or announce victory if every senator still holding rights belongs to their own party. Every senator plays the best strategy for their party. Given the string `senate`, return `"Radiant"` or `"Dire"`, the party that announces victory.
The senate of the Dota2 world has senators from two parties, Radiant (R) and Dire (D). Voting runs in rounds, in seat order. On their turn, a senator who still has rights may either ban one other senator, who then loses every right in this and all later rounds, or announce victory if every senator still holding rights belongs to their own party. Every senator plays the best strategy for their party. Given the string senate, return "Radiant" or "Dire", the party that announces victory.
Example 1:
Input: {"senate":"RD"}
Output: Radiant
Constraints:
n=senate.length
1≤n≤104
senate[i] is either ′R′ or ′D′.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"senate":"RD"}
senate (seat order = speaking order)
R 1 vs D 1 · 0 banned
R
0
D
1
There are 2 senators. Each one, on their turn, should ban the next opposing senator who would act soonest.