← All problemsSign in

Tyrion and Jamie (Medium)

Tyrion and Jaime are playing a game with a string $s$, consisting of lowercase English alphabets. In each turn, one of them should choose two consecutive equal letters in the string and kill them. For example, if the string is equal to "pddp" then there are only two possible turns:Tyrion kills "dd", so the string will become "pp". Now Jaime kills "pp". Tyrion now can't make a move so he loses.

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start