What are LeetCode Problems

205. Isomorphic strings (simple)

LeetCode problem solving-Python

Use two strings s and t to determine whether they are isomorphic.
If the characters in s can be substituted to get t, the two strings are isomorphic.
All occurrences of characters must be replaced with another character, maintaining the order of the characters. Two characters cannot be mapped to the same character, but the character can be mapped to itself.
Example 1:
Input: s = "egg", t = "add"
Output: true
Example 2:
Input: s = "foo", t = "bar"
Output: false
Example 3:
Input: s = "paper", t = "title"
Output: true
You can assume that s and t are the same length.

Problem solving ideas

Isomorphism: Two strings must match one to one and the order cannot be changed
Store two strings (string one, string two) in the key and value, respectively, in the dictionary.
If the x of string one is in the key, but the value for x is not in string two, an error has occurred.
If the x of string one is not in the key, but the value in string two is in the value, then there is an error.
The enumerate () function is used to combine a traversable data object (such as a list, a tuple, or a string) into an index sequence while listing data and data indexes that are commonly used in the for loop.

I don't know if the description is clear (#.#) Everyone will understand the code
Please point out any errors


Link: https: //github.com/seattlegirl/leetcode/blob/master/isomorphic-strings.py.

Question code (python3)