Palindromic number
You are given a string $S$ consisting of $N$ digits from $0$ to $9$. You want to obtain a palindrome from $S$ using some operations. There are $M$ different types of operations you can make on $S$. Each operation is described by three integers $X$, $Y$ and $W$. In this operation, if there is a digit equal to $X$ in $S$, you can replace $X$ with $Y$ using $W$ coins. For example, if $X = 4, Y= 5,
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