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.
Your solution is correct, but fails on a minor part.
Read this for more info
Reraised above with more detail
Wowo, didn't see that way to check if x is a triangular number on that page and came up with similar solution, allthough mine has one additional check that is not required.
You have a strange definition of "cheating", which apparently includes, "doing math".
I can't believe how many times I have to say this: if math can solve a problem, or even just make it simpler, use math before programming. It's the smart thing to do.
Me too, as I already stated. :-)
This comment is hidden because it contains spoiler information about the solution
Already raised an issue please share your opinion to make nottice the developers how important is it. https://github.com/Codewars/codewars-runner-cli/issues/181
Doesn't work as expected in C# at all.
BROKEN.
The test fixture doesn't compile at all and the test case expects string when the Kata asks for an int[] as the return type.
Could get around it but definitely not what is expected at all.
UGH, Codewars needs to fix this 500+ solution locking. I'm sick of starting Katas only to quickly learn I can't submit a solution because it's broken and CAN NOT BE FIXED.
Yes please, I also would like to delete a less elegant solution of mine.
I don't understand very well your question. You must use Leibniz formula. It is true that epsilon is small in test6 but almost 80 Codewarriors passed the kata in C# hence it is doable:-)
You are very kind but it's you who has to find errors!-)
Read the description and watch the drawing. There is no need to use integrals and I would say that, if you want to pass the kata, you musn't use integrals. Use Pythagorean theorem for each segment of the polygonal curve.
Why do you think it is wrong? The example gives an approximation of the length when n=1 and then when n=10. Wolfram gives the result of an "exact" calculation with an integration. The kata gives an approximation of the result by using a sum of lengths of polygonal lines.These two things are different though when n is really big the two things are quite the same.
Take a piece of paper and a pencil. Draw
y=x*x
with x in [0,1] and choose n=1. The polygonal curve approximating the function is then simply the diagonal of the square [0,1]x[0,1], the length of which is exactly sqrt(2)!I think you have misunderstood the description.
Note: before saying that something is wrong, be sure to have understood this something:-) You could 'google' "Approximation of an arc length".
Edit: thanks to CrazyMerlyn for his answer.
This Kata is about approximating the length of the curve by taking dicrete distances from 0 to 1 in n steps.
While wolframalpha tries to give the precise answer to the problem, the result of our function will be dependent on the number of points we chose.
Using the least number of points, 1, gives the worst answer. As you increase the value of n though, the solution for this kata will get closer and closer to the wolframalpha answer.
For example, at
n = 100000
, my solution returns1.47894285754
which is correct upto 11 decimal placesLoading more items...