# Question

Formatted question description: https://leetcode.ca/all/161.html

 161	One Edit Distance

Given two strings s and t, determine if they are both one edit distance apart.

Note:

There are 3 possibilities to satisfy one edit distance apart:
Insert a character into s to get t
Delete a character from s to get t
Replace a character of s 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 = "cab", t = "ad"
Output: false
Explanation: We cannot get t from s by only one step.

Example 3:

Input: s = "1203", t = "1213"
Output: true
Explanation: We can replace '0' with '1' to get t.

@tag-dp


# Algorithm

To determine whether the edit distance of two strings is 1, consider the following three situations:

1. The difference between the length of the two strings is greater than 1, and it returns False directly.
2. The difference between the lengths of the two strings is equal to 1. The longer string has one character removed, and the rest should be the same as the short string.
3. The difference between the length of the two strings is equal to 0, and the characters at the corresponding positions of the two strings can only be different in one place.

Java