Nice to preallocate the StringBuilder, but why are you dragging floating point into the calculation? The result has to be an integer, so you might as well, do everything in integer math.
This comment is hidden because it contains spoiler information about the solution
Tsk,Tsk. You always do the entire calculation twice. sloppy & wasteful.
then make one lol
its called community effort...
The kata specification assures us that the parameters are in range, so there's no point in checking.
Further, checking you are doing is insufficent and misleading. You check for too low, but not too high. And it's wrong. Given Past(-1, 1,0) will return 60000, but it's an invalid time. There is no correct answer. If you needed to check the range, it should be:
if (h <0 || h > 23)
throw new ArgumentOutOfRangeException("h", "Hour must be in range (0...23)");
He has defeated all challengers. He has not lost to anyone. That's a victory.
Why should he win if there are no dragons to fight?
Spilled coffee on the forward slash key and didn't know another way to divide by two. I was also unable to post questions... they all looked like sentences with no punctuation at the end. It was a rough day.
Division is the slowest of the basic arithmetic operations, and you do the same division TWICE? What's wrong one division with a simple ">=" ?
Why are we dragging floating point math into a simple integer calculation?
If there are zero dragons, he's still a hero, even if he has no bullets, which makes the first clause in the if() both unnecessary and conterproductive.
If there are zero dragons, he's still a hero, even if he has no bullets, which makes the second clause in the if() both unnecessary and conterproductive.
Why should he fail if the number of dragons is zero? That should be an easy win for him.