← AlgoMindset 75

Dota2 Senate

Medium🎙 Interview me on this

🧠 Before you code — what pattern fits?

The Dota2 senate consists of Radiant (R) and Dire (D) senators voting in rounds. Each senator can ban one senator from the other party in order. Rounds repeat with the surviving senators until one party remains. All senators play optimally.

Given the string senate, predict which party announces victory: return "Radiant" or "Dire".

"RD" → "Radiant"

"RDD" → "Dire"

🎬 Video explanation · NeetCodeIO

Your solution runs against 3 unit tests, including edge and large-value cases.

Loading...

Test console · 3 unit tests

Submit your code to run it against all 3 unit tests. Results appear here.

JavaScript, TypeScript & Python run sandboxed in your browser; other languages run on the execution server. Your code is saved locally as you type.