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.
TypeScript translation
Java translation
Reference solution for the random tests is incorrect:
area(70, -175, -528)
do not accept2564
as answer:https://www.wolframalpha.com/input?i=area+between+y%3D70x%5E2-175x-528+and+y%3D0
Floating point errors and strict under-estimate/over-estimate means that this is a deeply flawed way of testing.
area(1, 0, -9)
is exactly36
, which will get truncated to35
because of this. It only makes sense if you're asking for a closed-form solution of the result (which exists), but the description suggests otherside, and yet floating point error already plagues the actual tests at the moment.Please use proper floating point comparison and return the result not as a
int
.(Also,
double
should be used.float
is too inaccurate for these kinds of tasks).This task (numerical integration of area) is a duplicate to katas such as https://www.codewars.com/kata/587c0d396d360f3cc600003f, https://www.codewars.com/kata/5562ab5d6dca8009f7000050 and https://www.codewars.com/kata/565abd876ed46506d600000d.