Python Solution


  • 0
    N

    Python solution with dictionary

    mapp = {}
            for i in range(len(s)):
                if s[i] not in mapp:
                    if t[i] in mapp.values():
                        return False
                    mapp[s[i]] = t[i]
                    continue
                if mapp[s[i]] != t[i]:
                    return False
            return True
    

Log in to reply
 

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