Sale
Summer Offer: $190/yr $99/yr
00 : 00 : 00 : 00
Get this deal
Backend Engineer Senior programming

Implement a function to determine if two strings are one edit away from being the same string. An edit can be an insertion, deletion, or replacement of a character. Please implement the following function:


def isOneEditAway(first: str, second: str) -> bool:

Constraints:


  • 0 <= first.length, second.length <= 100

  • Both strings consist of lowercase English letters.


Example 1:


Input: first = "pale", second = "ple"
Output: true

Example 2:


Input: first = "pales", second = "pal"
Output: false
Suggested Answer

Trusted by 100+ professionals preparing for interviews

Trusted by 100+ professionals 50+ Company Question Banks 5+ Supported Languages

Practice More Questions Like This

Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.

Get Started Free
Link copied to clipboard