https://leetcode.com/problems/merge-similar-items/



Runtime: 131 ms, faster than 83.33% of Python3 online submissions for Merge Similar Items.

Memory Usage: 14.9 MB, less than 50.00% of Python3 online submissions for Merge Similar Items.



```python
class Solution:
    def mergeSimilarItems(self, items1: List[List[int]], items2: List[List[int]]) -> List[List[int]]:
        #4:13
        dict_a = {}
        dict_b = {}
        
        for item in items1:
            key = item[0]
            value = item[1]
            dict_a[key] = value
            
        for item in items2:
            key = item[0]
            value = item[1]
            dict_b[key] = value
            
            
        dict_c = {}
        for key,value in dict_a.items():
            if key in dict_b:
                dict_c[key] = value + dict_b[key]
            else:
                dict_c[key] = value
        for key,value in dict_b.items():
            if key not in dict_a:
                dict_c[key] = value
        
        result = [[key, value] for (key, value) in dict_c.items()]
        result.sort(key=lambda item: item[0])
        return result
        #4:20
```

___


Hold on, then tomorrow is another new day.
