One Away Transformation Problem
Given two strings, A
and B
, determine whether A
can be transformed into B
by performing at most one of the following operations (including zero operations):
1. Delete a character from any position. 2. Replace a character with any other character. 3. Insert a character at any position.
Input:
Input begins with a single integer T
, which stands for the number of test cases. Each test case has two lines: the first line is a string A
, and the second line is a string B
.
Output:
For each test case, output "True" if string A
can be transformed into string B
, "False" otherwise.
Example:
Input:
T = 1
A = "pale"
B = "ple"
Output:
True
Constraints:
1 ≤ T ≤ 100
1 ≤ |A| ≤ 104
1 ≤ |B| ≤ 104
- Both strings contain only lowercase English letters.
Note:
You do not need to print anything; it has already been handled. Just implement the function provided.
Be the first one to answer
Add answer anonymously...
Top PayPal Software Developer Intern interview questions & answers
Popular interview questions of Software Developer Intern
Top HR questions asked in PayPal Software Developer Intern
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app