Tap here to switch tabs
Problem
Submissions

Problem: Difference Between Element Sum and Digit Sum of Array

Difference Between Element Sum and Digit Sum of Array asks you to compare an array's element sum with the sum of all its digits, returning their absolute difference.

Statement

You are given an array of positive integers nums.

The element sum is the sum of all elements in nums.
The digit sum is the sum of every digit that appears in nums.

Return the absolute difference between the element sum and the digit sum of nums.

Constraints:

  • 1≤1 \leq nums.length ≤2000\leq 2000

  • 1≤1 \leq nums[i] ≤2000\leq 2000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Difference Between Element Sum and Digit Sum of Array

Difference Between Element Sum and Digit Sum of Array asks you to compare an array's element sum with the sum of all its digits, returning their absolute difference.

Statement

You are given an array of positive integers nums.

The element sum is the sum of all elements in nums.
The digit sum is the sum of every digit that appears in nums.

Return the absolute difference between the element sum and the digit sum of nums.

Constraints:

  • 1≤1 \leq nums.length ≤2000\leq 2000

  • 1≤1 \leq nums[i] ≤2000\leq 2000