Question: Write a function: class Solution { public String solution ( String S , String T ) ; } that, given two strings S and T
Write a function:
class Solution public String solutionString S String T;
that, given two strings S and T consisting of N and M characters, respectively, determines whether string T can be obtained from string S by at most one simple operation from the set specified below. The function should return a string:
"INSERT c if string T can be obtained from string S by inserting a single character c at the beginning of the string,
"CHANGE c d if string T can be obtained from string S by replacing a single occurrence of character c with a single character dthese characters should be distinct;
SWAP c d if string T can be obtained from string S by swapping two characters c and dthese characters should be distinct and in the same order as in string S exactly one swap is performed
NOTHING" If no operation is needed strings T and S are equal; IMPOSSIBLE if none of the above works.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
