My One line python solution using set()


  • 0
    class Solution(object):
        def isIsomorphic(self, s, t):
            """
            :type s: str
            :type t: str
            :rtype: bool
            """
            return len(set(zip(list(s),list(t)))) == len(set(s)) == len(set(t)) and len(s)==len(t)
    

Log in to reply
 

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