• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
July 04, 2022 |810 Views
Converting one string to other using append and delete last operations
  Share   Like
Description
Discussion

Given an integer k and two strings str1 and str2 determine whether or not we can convert str1 to str2 by performing exactly k of the below operations on str1. 
a) Append a lowercase English alphabetic letter to the end of the str1. 
b) Delete the last character in str1 (Performing this operation on an empty string results in an empty string)

Input : k = 7, str1 = aba, str2 = aba
Output : Yes
(4 operations to convert str1 to an 
empty string(to make string empty we 
have to perform one more delete 
operation) and 3 append operations)


Converting one string to other using append and delete last operations : https://www.geeksforgeeks.org/converting-one-string-using-append-delete-last-operations/

Read More