Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Brilliant solution. It uses a arithmetic series formula to directly compute the sum of all multiples of 3 or 5 below a given number.
Moral of the Story: Regardless how much we practiced in DSA, if we neglect the training on our math intuition, we will totally misses the chance to convert our code into O(1)!
When you spent 40 minutes creating a recursive method because you saw the word "Recursive sum"...
.
.
.
.
And you saw others solved it with the math approach using 1 liner..
dude (;-;)/