Skip to content

Commit 4b39d0e

Browse files
committed
May 27
1 parent dbce827 commit 4b39d0e

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Solution:
2+
def differenceOfSums(self, n: int, m: int) -> int:
3+
return (n * (n + 1) // 2) - (m * (n // m) * (n // m + 1))
4+
5+
6+
def main():
7+
n = 10
8+
m = 3
9+
assert Solution().differenceOfSums(n, m) == 19
10+
11+
n = 5
12+
m = 6
13+
assert Solution().differenceOfSums(n, m) == 15
14+
15+
n = 5
16+
m = 1
17+
assert Solution().differenceOfSums(n, m) == -15
18+
19+
20+
if __name__ == '__main__':
21+
main()

2025-05-May-LeetCoding-Challenge/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
| May 23 | [3068. Find the Maximum Sum of Node Values](https://leetcode.com/problems/find-the-maximum-sum-of-node-values/) | Hard | Unsolved |
3030
| May 24 | [2942. Find Words Containing Character](https://leetcode.com/problems/find-words-containing-character/) | Easy | Solved |
3131
| May 25 | [2131. Longest Palindrome by Concatenating Two Letter Words](https://leetcode.com/problems/longest-palindrome-by-concatenating-two-letter-words/) | Medium | Solved |
32-
| May 26 | []() | | |
33-
| May 27 | []() | | |
32+
| May 26 | [1857. Largest Color Value in a Directed Graph](https://leetcode.com/problems/largest-color-value-in-a-directed-graph/) | Hard | Unsolved |
33+
| May 27 | [2894. Divisible and Non-divisible Sums Difference](https://leetcode.com/problems/divisible-and-non-divisible-sums-difference/) | Easy | Solved |
3434
| May 28 | []() | | |
3535
| May 29 | []() | | |
3636
| May 30 | []() | | |
@@ -40,6 +40,6 @@
4040
## Summary
4141
| Level | Problems | Solved | Unsolved |
4242
| --- | --- | --- | --- |
43-
| Easy | 6 | 6 | 0 |
43+
| Easy | 7 | 7 | 0 |
4444
| Medium | 13 | 10 | 3 |
45-
| Hard | 5 | 1 | 4 |
45+
| Hard | 6 | 1 | 5 |

0 commit comments

Comments
 (0)