Python3 | Simple and Intuitive Solution
Intuition\nFor a word to be uncommon, it should occur just once in the combined array made by splitting s1 and s2 into arrays.\n\nBecause if it appears more tha
# Intuition\nFor a word to be <b>uncommon</b>, it should occur just once in the combined array made by splitting s1 and s2 into arrays.\n\nBecause if it appears more than once, it necessarily implies one of the three constraints that makes our words not <b>uncommon</b> - \n\n(i) the word has occured in both s1 and s2\nExample: s1 = "I delusional", s2 = "I not delusional", not **uncommon** words are "I" and "delusional".\n\n(ii) the word has occured more than once in s1 or s2\nExample: s1 = "I say words twice twice", s2 = "This pointless activity", not **uncommon** word is "twice".\n\n(iii) both\nExample: s1 = "I say words twice twice", s2 = "He says twice", not **uncommon** word is "twice".\n\n# Approach\n\n- Create arrays out of s1 and s2.\n- Merge them.\n- Create a hashmap.\n- Run a loop over the merged array and store the frequency of each word in the hashmap.\n- Run a loop over hashmap and store the words with frequency == 1 in a "result" array.\n- Return the "result" array.\n\n\n# Complexity\n\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\n# Code\n```python3 []\nclass Solution:\n    def uncommonFromSentences(self, s1: str, s2: str) -> List[str]:\n\n        s1 = s1.split(" ")\n        s2 = s2.split(" ")\n\n        s1.extend(s2)\n\n        hashmap = defaultdict(int)\n\n        for i in s1:\n            hashmap[i] += 1\n\n\n        result = []\n\n        for i in s1:\n            if hashmap[i] == 1:\n                result.append(i)\n\n        return result\n        \n```
['Python3']