Skip to content

Files

Latest commit

author
Mauricio Klein
Dec 2, 2019
17544c5 · Dec 2, 2019

History

History

challenge-49

Buddy strings

This problem was asked by AirBnB.

Description

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.

Example

Input: A = "ab", B = "ba"
Output: True

Input: A = "ab", B = "ba"
Output: False

Input: A = "aa", B = "aa"
Output: True

Input: A = "aaaaaaabc", B = "aaaaaaacb"
Output: True

Input: A = "", B = "aa"
Output: False