- See Code
O(n)
class Solution:
def uncommonFromSentences(self, A: str, B: str) -> List[str]:
cnt = collections.Counter((A + ' ' + B).split(' '))
return [w for w, c in cnt.items() if c == 1]
O(n)
class Solution:
def uncommonFromSentences(self, A: str, B: str) -> List[str]:
cnt = collections.Counter((A + ' ' + B).split(' '))
return [w for w, c in cnt.items() if c == 1]