Given two strings str1 and str2, the task is to check if the two given strings are isomorphic to each other or not.

_Two strings are said to be isomorphic if there is a one to one mapping possible for every character of str1 to every character of str2 and all occurrences of every character in __str1 _map to same character in str2.

Examples:

Input:_ str1 = “egg”, str2 = “add”_

Output:_ Yes_

Explanation:

‘e’ in str1 with ASCII value 101 is mapped to ‘a’ in str2 with ASCII value 97.

‘g’ in str1 with ASCII value 103 is mapped to ‘d’ in str2 with ASCII value 100.

Input:_ str1 = “eggs”, str2 = “addd”_

Output:_ No_

Recommended: Please try your approach on {IDE} first, before moving on to the solution.

Hashing Approach: Refer to the previous post for the Hashmap based approach.

Time Complexity:_ O(N)_

Auxiliary Space:_ O(256)_

#c programs #hash #mathematical #school programming #ascii #c++

C Program to check if two given strings are isomorphic to each other
2.80 GEEK