Practice Difference Between Element Sum and Digit Sum of an Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Add all integers in nums to obtain the element sum. Separately add every decimal digit of every integer, counting repetitions, to obtain the digit sum. Return the absolute difference between those two totals.
Source: Difference Between Element Sum and Digit Sum of an Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [1,15,6,3]
Output
9
# Example 2
Input
nums = [1,2,3,4]
Output
0
Constraints
1 <= nums.length <= 2000
1 <= nums[i] <= 2000
Related LeetCode Problems
Practice more problems similar to Difference Between Element Sum and Digit Sum of an Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.