Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
imteekay committed Oct 17, 2023
1 parent 050f69f commit 6444003
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// https://leetcode.com/problems/divisible-and-non-divisible-sums-difference

function differenceOfSums(n, m) {
let num1 = 0,
num2 = 0;

for (let num = 1; num <= n; num++) {
if (num % m === 0) num2 += num;
else num1 += num;
}

return num1 - num2;
}

0 comments on commit 6444003

Please sign in to comment.