Convert one string to another by changing all occurrence of a character to another

In this article, We will be solving Check if one string can be converted to another by changing all occurrence of a character to another character problem using the Union and Find algorithm. In this problem we are given two strings str1 and str2, our job is to check whether the string str1 can be converted to string str2 by converting all the occurrences of a character to another character.

For example:

Input: str = “wxxyww”; str1 = “xyyzxx”Output: YesExplanation: The mappings of the character...
 •  0 comments  •  flag
Share on Twitter
Published on May 08, 2021 16:55
No comments have been added yet.