← All problemsSign in

Cost Maximization

You are given a binary string of length $N$. You can remove a substring `01` to gain $C_{0}$ coins and a substring `10` to gain $C_{1}$ coins. After removing a substring, the remaining two strings will be concatenated to form the new string. For example in string `11011` after removing `10` from the string the two parts will be `1` and `11`. Now the string will become `111`. What is the maximum

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