Binary String Cost
According to the new tax scheme, a new tax called the binary string tax was introduced! JJ has a binary string $S$ of length $N$. According to the tax scheme, for every occurrence of $01$ in $S$, a tax of $X$ rupees will be charged, while for every occurrence of $10$ in $S$, a tax of $Y$ rupees will be charged. For example, if $X = 5$, $Y = 7$ and $S = 11010$, then $S$ has $1$ occurrence of $01$
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.
Sign in to chat with the tutor and save your progress.
Sign in to start