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.
Input: s = "egg", t = "add"
Input: s = "foo", t = "bar"
Input: s = "paper", t = "title"
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)
- Will Hezbollah suppress protests in Lebanon?
- How much does a blast furnace cost
- How can we generate energy from liquid?
- Why Marketing CFOs Are Looking For A Startup
- Is math required for biomedical science
- Will Java die out in the future
- How do I buy and sell trade
- What is 3A in Zug
- The word supposedly means apparently
- Are animals racist or just humans?
- Can I fly with an ear infection?
- What is electro smog
- How does the battery life decrease
- How much does it rain in Vietnam
- Can see people through vertical blinds
- Would you survive
- Why do hydroxyl groups donate electrons
- Is a good Chinese male name
- Why is the American middle class shrinking
- How should I download Audio Network videos
- How can there be 0 degrees Celsius
- Is virtual football betting profitable?
- How do you feel about a question
- What does sunlight mean