0
点赞
收藏
分享

微信扫一扫

【leetcode】205-Isomorphic Strings

骨灰级搬砖工 2022-07-12 阅读 14

problem

​​205-Isomorphic Strings​​

 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;
}
};

需要注意的

1;//
hash_t[t[i]] = i+1;//

 

 

 

参考

1. ​​Leetcode_Isomorphic Strings​​;

举报

相关推荐

0 条评论