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.
You are trying to declare an int variable with a double value, which obviously won't work.
However, in this case it works, because compilator knows that the type of sum variable is int and it just casts it to int. Since the result of pow is an integer (double), nothing special happens, but if the result were a non-integer, then the decimal part of the method's result would be truncated (100.18 would be 100, 11.254 would be 11, 1.0 would be 1, and so on, and so on...).
I know this comment is 7 months old, but I wanted to clear it up.
That is correct, why does this code work. It shouldn't at all.
This comment is hidden because it contains spoiler information about the solution
Tests "TestAdvanced" and "TestRandom" takes function output as expected value. This introduces confusion as it is unclear what test is actually expecting without knowing this fact.