ZapCom Group Interview Question

Adding triplets from array problem.