HackerRank Solution | Append And Delete

HackerRank Solution | Append And Delete

Append and Delete Problem Statement

You have two strings of lowercase English letters. You can perform two types of operations on the first string:

  • Append a lowercase English letter to the end of the string.
  • Delete the last character of the string. Performing this operation on an empty string results in an empty string.
Given an integer, k, and two strings, s and t, determine whether or not you can convert s to t by performing exactly k of the above operations on s. If it's possible, print Yes. Otherwise, print No.


Append and Delete Solution Code

Note: These solutions are absolutely not the most optimized and effecient one. These are very beginner style approach and was solved without prior knowledge of CS concepts like DataStructures and Algorithms that are usually taught in colleges.

Python Code

Post a Comment

0 Comments