Google | Onsite | Transform one string into another with find and replaceAll
Anonymous User
6763

I got this question during an Google onsite interview and I haven't seen it anywhere on the internet. It's a bit similar to edit distance.

I don't remembers all the details but it was something like this:

You are given 2 strings A and B and you have 2 operations find that finds a character in a String and replaceAll that replaces all occurrences of a given character with another character in a String. The task is to first check if it's possible to transform A to B and if it is then to transform it in place.

I couldn't solve it back then. They told me that it could be solved with breadth first search.

Comments (7)