Sobes.tech
Junior — Senior

Checking the possibility of converting a string in a single edit

livecode

Task condition

A method that checks whether it is possible to obtain one string from another by performing exactly one of the following operations:

  • replacing one character
  • inserting one character
  • deleting one character

Examples: "a" → "b" → true "ab" → "b" → true "ab" → "cb" → true "ab" → "ba" → false

public boolean editing(String s1, String s2) {
    // implementation
}