2363. Merge Similar Items
On This Page
class Solution:
def mergeSimilarItems(
self, items1: List[List[int]], items2: List[List[int]]
) -> List[List[int]]:
cnt = Counter()
for v, w in chain(items1, items2):
cnt[v] += w
return sorted(cnt.items())