UnitedHealth Group Interview Question

Iteration of array list and find some pattern sum.