Preview:
#not working
def removeDuplicates(self, s: str) -> str:
        lis=[""]
        for i in s:
            if i not in lis:
                lis.append(i)
            elif i in lis:
                lis.remove(i)
        return ''.join(lis)
#working
def removeDuplicates(self, s: str) -> str:
        stack = [""]
        for c in s:
          if stack[-1] == c:
            stack.pop()
          else:
            stack.append(c)
        return ''.join(stack)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter