Buddy Strings
A swap exchanges the characters at two different positions of s. Return True if exactly one swap of two positions of s makes it equal to goal, otherwise False. Note that you must make a swap, so if s already equals goal you need two equal letters to swap.
Example 1
s "ab"
goal "ba"
returns true
Swap the two letters.
Example 2
s "ab"
goal "ab"
returns false
Swapping always changes it, so False.
Constraints
1 <= len(s), len(goal) <= 30- Lowercase letters only
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.