← Cognizant questions
CodingReported in a candidate post, Sep 2021

Difference between sum of even and odd index elements

Filed under Cognizant

Given an array of integers, compute the sum of elements at even indices and the sum of elements at odd indices separately. Return the absolute difference between these two sums.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Cognizant questions

Collected from public candidate posts and coding forums. Updated Nov 2026.