Search
⌘K

Leetcode 2894. Divisible and Non-divisible Sums Difference

Compute the difference between the sum of integers in [1, n] not divisible by m and the sum of those that are; use arithmetic series/count of multiples to get the result in O(1) time (equivalently total_sum - 2 * sum_of_multiples_of_m).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.