It has been some time since anyone put up any programming questions on lnexun, so I figured I might be the one to upset the status quo. The following is the background you need for the questions.
So there is a string. Nothing special about it. Just your common everyday collection of ASCII characters. Then there is is person A. The only string operations person A is capable of performing are adding, removing, replacing (and choosing to do nothing to) one character in the string at a time. To clarify, he may only look at one character from the string he is working on at a time and then choose to perform either of the said operations on it. He is then free to look at any other character.
Q1. Suppose we give person A strings ‘a’ and ‘b’. I want your program to calculate, given these two strings, the minimum number of operations A needs to perform on a to convert it to b. There is no reason for len(a) to be equal to len(b).
Q2. (Harder) Tell me how (any one way) he would perform the conversion from a to b.
Email answers to nisheeth@gmail.com. Any questions go in the comments.
BTW I saw these on a programming contest we did for the local highschools. You guys could probably do the rest in your sleep, so I gave you the one that noone got. Don’t let that deter you, it’s very doable.
Happy hacking.
–Nisheeth