No, 14! == 87178291200 there are two trailing zeros there.
14! == 87178291200
I believe for scala
should be assert(Solution.zeros(14) == 1) not assert(Solution.zeros(14) == 2)
Okay, that was indeed overflow issue. My buffer was initialized as Int. Thanks for quick response!
@sitetester: I already gave you an answer. Ask yourself, why are you returning a negative number? (what makes it happen and how can you avoid it?)
@sitetester
There's 276 scala completions, so it's not an issue with kata itself.
Same issue -1961650628 did not equal 2333316668 for scala
-1961650628 did not equal 2333316668 for scala
ooh well I had fixed that a while back.. :)
That's not the input, that's your output. So it's you who generated a negative number out of positive numbers ;-)
(Also, as you know, you can always see the input by printing it out.)
Negative integers aren't natural numbers by the generally-accepted mathematical definition.
My mistake I thought negative integers were not natural numbers
Well the kata didnt say negative natural numbers ?
Not an issue. You should figure out why yourself ;-)
Translated kata to scala
I have added random tests to approve same.
This comment is hidden because it contains spoiler information about the solution
Loading collection data...
No,
14! == 87178291200
there are two trailing zeros there.I believe for scala
should be assert(Solution.zeros(14) == 1) not assert(Solution.zeros(14) == 2)
Okay, that was indeed overflow issue. My buffer was initialized as Int. Thanks for quick response!
@sitetester
: I already gave you an answer. Ask yourself, why are you returning a negative number? (what makes it happen and how can you avoid it?)There's 276 scala completions, so it's not an issue with kata itself.
Same issue
-1961650628 did not equal 2333316668 for scala
ooh well I had fixed that a while back.. :)
That's not the input, that's your output. So it's you who generated a negative number out of positive numbers ;-)
(Also, as you know, you can always see the input by printing it out.)
Negative integers aren't natural numbers by the generally-accepted mathematical definition.
My mistake I thought negative integers were not natural numbers
Well the kata didnt say negative natural numbers ?
Not an issue. You should figure out why yourself ;-)
-1961650628 did not equal 2333316668 for scala
Translated kata to scala
I have added random tests to approve same.
This comment is hidden because it contains spoiler information about the solution
Loading more items...