My C 0ms solution


  • 34
    R
    bool isIsomorphic(char* s, char* t) {
    	char charArrS[256] = { 0 };
    	char charArrT[256] = { 0 };
    	int i = 0;
    	while (s[i] !=0)
    	{
    		if (charArrS[s[i]] == 0 && charArrT[t[i]] == 0)
    		{
    			charArrS[s[i]] = t[i];
    			charArrT[t[i]] = s[i];
    		}
    		else
    		if (charArrS[s[i]] != t[i] || charArrT[t[i]] != s[i])
    			return false;
    		i++;
    	}
    
    	return true;
    }

  • 0
    J
    This post is deleted!

  • -3
    E
    This post is deleted!

Log in to reply
 

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