Skip to content

Commit

Permalink
Q2535 added.
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Feb 27, 2023
1 parent 0e757c3 commit 48ae753
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions E_2535_DifferenceBetweenElementSumandDigitSumofanArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Solution {
public int differenceOfSum(int[] nums) {
int elSum = 0;
int digitSum = 0;
for( int num : nums){
elSum += num;
while (num > 0){
digitSum += num%10;
num = num/10;
}
}
return Math.abs(elSum-digitSum);
}
}

0 comments on commit 48ae753

Please sign in to comment.