Timer is Running

String Conversion
Submissions: 30   Accuracy:


  Difficulty: Medium   Marks: 4
Associated Course(s):   Geeks Classes

Given two strings X and Y, the task is to check if it is possible to convert X to Y by performing the following operations.

  •  Make some lowercase letters uppercase.
  •  Delete all the lowercase letters.

Example 1:

Input: X = "daBcd", Y = "ABC"
Output: 1
Explanation: Convert 'a' and 'c', delete
both the d's

Example 2:

Input: X = "ABcd", Y = "BCD"
Output: 0
Explanation: Can not delete A

Your Task:  
You don't need to read input or print anything. Your task is to complete the function stringConversion() which takes the strings as input and returns 1 if it is possible to convert, otherwise 0.

Expected Time Complexity: O(|X|*|Y|)
Expected Auxiliary Space: O(|X|*|Y|)

1 ≤ |X|, |Y| ≤ 103

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Nishant singh
Author: Nishant_Singh

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.