Python dictionary (explained) -- 20ms | 99.86% | Linear T/S
This is a linear time/space solution passing over each split string and recording frequency of the word in a dictionary. If the word in the dictionary only has 
This is a linear time/space solution passing over each split string and recording frequency of the word in a dictionary. If the word in the dictionary only has a frequency of 1, it is uncommon (only occurred once inside of s1 + s2).\n\n```\nclass Solution:\n    def uncommonFromSentences(self, s1: str, s2: str) -> List[str]:\n        word_counts = {}\n        for word in s1.split(\' \'):\n            if word in word_counts:\n                word_counts[word] += 1\n            else:\n                word_counts[word] = 1\n        for word in s2.split(\' \'):\n            if word in word_counts:\n                word_counts[word] += 1\n            else:\n                word_counts[word] = 1\n        return [word for word in word_counts if word_counts[word] == 1]\n```\nHere is the same code, commented line-by line:\n```\n# Commented code\ndef uncommonFromSentences(s1, s2):\n\t# dictionary to hold the counts of each word\n    word_counts = {}\n\t# split string into words and loop over each\n    for word in s1.split():\n\t\t# if word is in dict, increment by one\n        if word in word_counts:\n            word_counts[word] += 1\n\t\t# if not, add new word, count pair starting at 1\n        else:\n            word_counts[word] = 1\n\t# same process for s2\n    for word in s2.split():\n        if word in word_counts:\n            word_counts[word] += 1\n        else:\n            word_counts[word] = 1\n\t# loop over all keys in dictionary... if they have a count of 1, they\n\t# are unique! Pop em into this list and return\n    return [word for word in word_counts if word_counts[word] == 1]\n```\n\nFinally, a time/space complexity analysis:\n\nOverall Time Space Complexity Analysis -- Since we have 2 inputs, `n` represents the length of `s1`, `m` represents the length of `s2`\n\nTime:\n* Looping over `s1` == `O(n)`\n* Looping over `s2` == `O(m)`\n* Looping over keys in dict == `O(n + m)`\n\nTotal Time Complexity is `O(n+m+n+m)` or `O(2n + 2m)` which can be written as `O(n + m)`\n\nSpace:\n* splitting `s1` == `O(n)`\n* splitting `s2` == `O(m)`\n* Creating return array == `O(n+m)`\nTotal Space Complexity is `O(n+m+n+m)` or `O(2n+2m)` which can be written as `O(n+m)` \n\t\n```\ndef uncommonFromSentences(s1, s2):\n\t# new dict potentially full of all different words in s1 + s2\n\t# Space: O(n + m)\n    word_counts = {}\n\t# spliting s1 --> Space: O(n) \n\t# looping over -->Time: O(n) \n    for word in s1.split(\' \'):\n\t\t# membership check in dict --> Time: O(1)\n\t\t# Adding k,v pairs is O(n) Space from dict analysis above\n        if word in word_counts:\n            word_counts[word] += 1\n        else:\n            word_counts[word] = 1\n\t# spliting s2 --> Space: O(m) \n\t# looping over -->Time: O(m) \n    for word in s2.split(\' \'):\n\t\t# membership check in dict --> Time: O(1)\n\t\t# Adding k,v pairs is O(m) Space from dict analysis above\n        if word in word_counts:\n            word_counts[word] += 1\n        else:\n            word_counts[word] = 1\n\t# create new array O(n + m) Space by looping over dict values O(n+m) Time\n    return [word for word in word_counts if word_counts[word] == 1]\n```\n\t\n\t\t
['Hash Table', 'String', 'Python']