This commit is contained in:
parent
d5429e9e22
commit
099ac0388d
1 changed files with 8 additions and 0 deletions
8
easy/divisible_and_non_divisible_sums_difference.py
Normal file
8
easy/divisible_and_non_divisible_sums_difference.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# https://leetcode.com/problems/divisible-and-non-divisible-sums-difference
|
||||
|
||||
class Solution:
|
||||
def differenceOfSums(self, n: int, m: int) -> int:
|
||||
l = n // m
|
||||
s = sum(range(n + 1))
|
||||
return s - (m + m * l) * l
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue