CASHFREE PAYMENTS OA | Difference Between Element Sum and Digit Sum of an Array | Off-Campus (2025)
Question · Posted Jun 2026
Problem Statement You are given a positive integer array nums. Define: Element Sum as the sum of all elements in the array. Digit Sum as the sum of all digits present in every element of the array. Return the absolute difference between these two sums: |Element Sum - Digit Sum| Example 1 Input nums = [1,15,6,3] Output 9 Explanation Element Sum: 1 + 15 + 6 + 3 = 25 Digit Sum: 1 + (1 + 5) + 6 + ...
The full answer & interview discussion are available to premium members.
Log in Create a free account