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.
[2, 0]
or[0, 2]
means one side of the package has a good apple, and the other side is bad.[0, 0]
means both sides of the package are bad, indicating a fully rotten package.you have something like: [1, -1, 6, -6, 5]
the reduce method give the number's sum, in this case it will be 5, and this is the correct answer.
But there is a problem maybe you have something like [1, -1, 6, -6, 5, 5], in this case the sum will be 10, because we have an additional 5, to avoid that, he has removed all the duplicated numbers in the array converting it to Set type