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.
Most loops start with i=0, so i=3 will be harder to compress, increasing script size and slowing down and git pushes.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
think about all cases: 2 odds, 2 even and 1 odd& 1even, you will find all cases lead to same result: even number.
Mine too!!! For pretty much everything!
I'm not English myself, so I understand the language problems, but I am not sure what you are asking, so please ask me again if I am answering the wrong question.
The kata wants the result rounded (look at the last sentence of the description), so I need to use
Math.round()
. Javadoc is found here: https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html#round-double-Note that if I pass in a double, it returns a long. That's why I need to add the
(int)
cast on the last line.Casting it to an
int
just throws away the decimal part, whileMath.round()
will round it to the nearest integer:Does that answer your question?