3 lines solution for C


  • 3
    S
    bool isIsomorphic(char* s, char* t) {
      for (int i = 0; i < strlen (s); i++)
        if ((strchr (s,s[i]) - s) != (strchr(t,t[i]) - t)) return false;
      return true;
    }

Log in to reply
 

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