W Energy Software interview question

Merge list items based on a common key