problem
code
class Solution { public: bool isIsomorphic(string s, string t) { if(s.size()!=t.size()) return false; int len = s.size(); char hash_s[128] = {0}, hash_t[128] = {0}; for(int i=0; i<len; i++) { if(hash_s[s[i]] != hash_t[t[i]]) return false; hash_s[s[i]] = i+1;// hash_t[t[i]] = i+1;// } return true; } };
需要注意的
hash_s[s[i]] = i+1;// hash_t[t[i]] = i+1;//
参考
1. Leetcode_Isomorphic Strings;
完