Question: Write a java function to solve the below s = adpgki, t = cdmxki, k = 6 1 . Change s 0 from ' a

Write a java function to solve the below
s = "adpgki", t="cdmxki", k=6
1. Change s0 from 'a' to 'c' with cost=abs('a'-'c')=2. String s is now "cdpgki" and k=6-2=4
2. Change s2 from 'p' to 'm' with cost =abs('p'-'m')=3. String s is 'cdmgki' and k=4-3=1
3. The only character left to change is 'g' to 'x' which costs more than k

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!