UnitedHealth Group interview question

Iteration of array list and find some pattern sum.