2652. Sum Multiples ¶
Approach 1: Brute Force¶
- Time: $O(n)$
- Space: $O(1)$
1 2 3 4 5 6 7 8 9 10 |
|
1 2 3 4 5 6 7 8 9 |
|
1 2 3 4 5 6 7 |
|
Approach 2: Intersection Theory¶
- Time: $O(1)$
- Space: $O(1)$
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
1 2 3 4 5 6 7 8 9 10 11 12 |
|