My python 100% run time solution

  • 0
    class Solution(object):
        def isIsomorphic(self, s, t):
            :type s: str
            :type t: str
            :rtype: bool
            d = {}
            value_set = set()
            for index, letter in enumerate(s):
                    if d[letter] != t[index]:
                        return False
                except KeyError:    
                    d[letter] = t[index]
                    if d[letter] in value_set:
                        return False
            return True

Log in to reply

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