DSG interview question

Flatten array and sum it.