Isomorphic Strings

    xiaoxiao2021-03-25  60

    哈希表,哈希的思想,不一定都要用unordered_map的....

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

    转载请注明原文地址: https://ju.6miu.com/read-35906.html

    最新回复(0)