Here is my simple 0ms C solution


  • 0
    O

    Here

    `

    bool isIsomorphic(char* s, char* t) {
    
        int map[256] = {0}; 
        char map2[256] = {0};
        char c;
        char c2;
        int i
        for (i = 0; (c = s[i]) != '\0'; i++) {
            c2 = map2[t[i]];
            if ((map[c] && (c != c2)) || (c2 && (c2 != c)) ) {
                return false;
            }   
            else {
                map[c] = 1;
                map2[t[i]] = c;
            }
        
        }
        return true;
    }
    

    `


Log in to reply
 

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