Python: Eliminating the 'u' for Unicode + Solution

  • 0

    I was getting a random 'u' in my solution and found it converting to utf-8 fixed the problem in case anyone was struggling. First time getting a problem 100% by myself, so I'm pretty proud.

    Not the most efficient way and can be shortened.

    class Solution(object):
    def findTheDifference(self, s, t):
    a = [s[x] for x in range(0,len(s))]
    b = [t[x] for x in range(0,len(t))]

        for x in a:     #a b c d
            if x in b:  #a b c d e
        for i in range(0,len(b)):
            return b[i]

Log in to reply

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