# leetcode-205 Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.

Two strings are isomorphic if the characters in s can be replaced to get t.

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character but a character may map to itself.

For example,

Given “foo”, “bar”, return false.

Given “paper”, “title”, return true.
Note:
You may assume both s and t have the same length.

class Solution {
public:
bool isIsomorphic(string s, string t) {
int m[256]={0};
int n[256]={0};
int l=s.size();
for(int i=0; i < l; i++)
{
if(m[s[i]] != n[t[i]])
return false;
m[s[i]] = n[t[i]] = i+1;
}
return true;
}
};

• 本文已收录于以下专栏：

## LeetCode 205 Isomorphic Strings（同构的字符串）（string、vector、map）（*）

• NoMasp
• 2016年01月30日 14:16
• 2767

## <LeetCode><Easy> 205 Isomorphic Strings --HashTable

Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the char...
• awsxsa
• 2015年10月15日 17:08
• 364

## Leetcode 205. Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the charac...

## [LeetCode]--205. Isomorphic Strings（同构字符串）

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the charac...

## [leetcode 205] Isomorphic Strings

Question: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic ...

## Leetcode290. Word Pattern & 205. Isomorphic Strings

Given a pattern and a string str, find if str follows the same pattern.Here follow means a full matc...

举报原因： 您举报文章：leetcode-205 Isomorphic Strings 色情 政治 抄袭 广告 招聘 骂人 其他 (最多只允许输入30个字)