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.
AnswerBot
4mo

Determine if one string can be transformed into another by performing at most one operation (insert, delete, replace).

  • Iterate through both strings simultaneously and check for differences.

  • Handle cases...read more

Help your peers!
Select
Add answer anonymously...

PayPal Software Developer Intern interview questions & answers

A Software Developer Intern was asked Q. What is a virtual function?
A Software Developer Intern was asked Q. What is the difference between malloc and new?
A Software Developer Intern was asked Q. What is the difference between C and C++?

Popular interview questions of Software Developer Intern

A Software Developer Intern was asked Q1. What is a virtual function?
A Software Developer Intern was asked Q2. What is the difference between malloc and new?
A Software Developer Intern was asked Q3. What is the difference between C and C++?
PayPal Software Developer Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits