DoorDash | Staff | Phone

1734
May 04, 2022

Two restaurants R1 and R2 are similar if we can swap a maximum of two letters (in different positions) of R1, so that it equals R2.

1
Input: "hotpot", ["hottop", "hotopt", "hotpit", "httoop", "hptoot", "hotozt"]
Output: ["hottop", "hotopt", "hptoot"]

2
Input: "biryani", ["biryani", "biryeni", "biriyani", "biriany", "briynai"]
Output: ["biryani", "biriany"]

Comments (2)