此为历史版本和 IPFS 入口查阅区,回到作品页
Zoka
IPFS 指纹 这是什么

作品指纹

LeetCode 205. Isomorphic Strings

Zoka
·
·
class Solution {
    
    public boolean isIsomorphic(String s, String t) {
        
        if(s.length()!=t.length()){
            return false;
        }
        
        char[] sChar = new char[256];
        char[] tChar = new char[256];
        
        for(int i=0; i<s.length(); i++){
            
            char sc = s.charAt(i);
            char tc = t.charAt(i);
            
            if(sChar[sc] == 0 && tChar[tc] == 0){
                sChar[sc] = tc;
                tChar[tc] = sc;
            }else if(sChar[sc] != tc){
                return false;
            }
            System.out.println(sc);
            System.out.println(tc);
            
        }
        return true;
    }
}


CC BY-NC-ND 2.0 授权