class Solution:
    def isIsomorphic(self, s: str, t: str) -> bool:
        s2t = {}
        seen = set()
        for i in range(len(s)):
            if s[i] in s2t and s2t[s[i]] != t[i]:
                return False
            elif s[i] not in s2t and t[i] in seen:
                return False
            else:
                s2t[s[i]] = t[i]
                seen.add(t[i])
        
        return True

Clever approach:

class Solution:
    def isIsomorphic(self, s: str, t: str) -> bool:
        return len(set(s)) == len(set(t)) == len(set(zip(s, t)))

Complexity

Time:
Space: because the dictionary size is fixed since there is a limited set of characters