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
It is the last test of the basic ones.
I change my code for it! True I was raising error only for negative value.
But it is still failing.
Is it the problem of case of donation = 0?
Only positive donation should be return.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Maybe you could google "C# throw error".
May I ask about the error cases. I am using c#. I have not idea how to return the error.
ErrorTests:
Expected: <System.ArgumentException>
But was: null
I return -1 now but got this result. Can anyone help?
If there is a little different of the numbers, you may check of your rounding method.
I understand what do you mean. I am not presenting well. I agree that it is the best way for the computer to run.
I just want to say that not all know this method. It also require your math skill.
Not everyone has good math skill, but this method is the most fast way and clever.
I'm going to have to completely disagree with you banny127: this is the best answer because it was calculated before coding.
Math first; code later. Your CPU will thank you.
Programmers need to have a ton of tools in their toolbox, and your casual dismissal of "algebra" is, frankly, terrifying--given that all programming boils down to logical/mathematical computations.
That depends on the view of what is the best solution. However, in most computer algorithms the best solution (out of all that give correct results) the best is where is minimum used memory & CPU time. This is a solution in constant time because there was a previous analysis with pen & paper. That is what I call a real optimization - the author found a way of different solving of the same problem using less resources.
This comment is hidden because it contains spoiler information about the solution