Question: You are given two strings, S and T , both of length N . Both strings are made up of digits. In a single move,
You are given two strings, and both of length Both strings are made up
of digits. In a single move, you can select an index within the range N
and increase the digits and by If a digit is increased, it
becomes
Is it possible to transform into by performing some possibly zero
number of such moves? If so what is the minimum number of moves
needed?
Write a function:
int solutionstring &S string &T;
that, given strings and each of length returns the minimum number of
moves needed to transform into If it is not possible to obtain in this
way, return
Examples:
For and the function should return
A valid sequence of moves could be as follows:
choose index and increase S and S two times. After these moves,
S becomes
choose index and increase S and S three times. After these
moves, S becomes
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
