Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B.
Input: A = "ab", B = "ba" Output: true
Input: A = "ab", B = "ab" Output: false
Input: A = "aa", B = "aa" Output: true
Input: A = "aaaaaaabc", B = "aaaaaaacb" Output: true
Input: A = "", B = "aa" Output: false
0 <= A.length <= 20000
0 <= B.length <= 20000
A and B consist only of lowercase letters.
Solution: Please check the main.js snippet for the solution. If you have different approach in mind or have any suggestion for this implementation feel free to share in the comment below. Thanks!