My accepted Java solution~~


  • 0
    W
    public boolean isIsomorphic(String s, String t) {
    	if(s == null || t == null) return false;
        if(s == "") return t == "";
        if(t == "") return false;
        
        for(int i = 0; i < s.length(); i++){
            char c1 = s.charAt(i);
            char c2 = t.charAt(i);
            if(s.lastIndexOf(c1) != t.lastIndexOf(c2))
                return false;
        }
        
        return true;
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.