Keep failing the example


  • 0
    T

    here is my code:

    class Solution(object):
        def findTheDifference(self, s, t):
            """
            :type s: str
            :type t: str
            :rtype: str
            """
            res = 0
            for c in s:
                res ^= ord(c)
            for c in t:
                res ^= ord(c)
            return chr(res)
    

    and result:

    Submission Result: Wrong Answer 
    Input:
    "abcd"
    "abcde"
    Output:
    "e"
    Expected:
    'e'
    

    i'm new to python. not sure what's wrong... any help?


Log in to reply
 

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