JavaScript


  • 0
    S
    var isIsomorphic = function(s, t) {
        if(s===t) return true;
        var lens= s.length;
        var i=1;
        if(lens!== t.length) return false;
        while(i<lens){
           if(s.indexOf(s[i])===t.indexOf(t[i])){
              i++;
           }else{
              break;
           }
        }
        return i === lens;
    };
    

Log in to reply
 

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