← ALL NOTES
Math

2894. Divisible and Non-divisible Sums Difference

Given n and m. num1 = sum of integers in [1, n] not divisible by m; num2 = sum of those divisible by m. Return num1 − num2. Direct pass over [1, n]: subtract the divisible ones, add the rest.

Loading…