Cumulative Palindrome Count
Gru has been ordering the minions to do a lot of work lately. Minions don't want to trust Gru anymore. So, they propose a problem to Gru. They will only help Gru if he can answer the problem correctly. The minions generate an endless string $s$ by following these steps: 1. Let $s$ be an empty string. 2. $i = 1$. 3. Append $i$ *a* s to the back of $s$. 4. Append $i$ *b* s to the back of $s$.
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