9 / 13

# One Edit Distance

Given two strings `s` and `t`, return `True` if they are both one edit distance apart, otherwise return `False`.

A string `s` is said to be one distance apart from a string `t` if you can:

• Insert exactly one character into `s` to get `t`
• Delete exactly one character from `s` to get `t`
• Replace exactly one character of `s` with a different character to get `t`

Example 1:

``````Input: s = "ab", t = "acb"
Output: True
Explanation: We can insert 'c' into s to get t.
``````

Example 2:

``````Input: s = "", t = ""
Output: False
Explanation: We cannot get t from s by only one step.
``````

Example 3:

``````Input: s = "a", t = ""
Output: True
``````

Example 4:

``````Input: s = "", t = "A"
Output: True
``````
INSTRUCTIONS

1. Write your code inside a function named `is_one_edit_distance`
2. Your code should work for all permitted possible values of `s` and `t`
3. There are no partial marks for the question.
4. Your function must return the output, it should not print the output.
5. To execute a block on the right side coding panel, please press 'shift'+ 'enter'

Complete the below code in the right side coding panel

``````def is_one_edit_distance(s: str, t: str) -> bool: