Ad
  • Custom User Avatar

    Your solution is correct, but fails on a minor part.

    Read this for more info

  • Custom User Avatar

    Reraised above with more detail

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Default User Avatar

    Me too, as I already stated. :-)

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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

  • Default User Avatar

    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.

  • Custom User Avatar

    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.

  • Custom User Avatar

    Yes please, I also would like to delete a less elegant solution of mine.

  • Custom User Avatar

    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:-)

  • Custom User Avatar

    You are very kind but it's you who has to find errors!-)

  • Custom User Avatar

    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.

  • Default User Avatar

    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.

  • Custom User Avatar

    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 returns 1.47894285754 which is correct upto 11 decimal places

  • Loading more items...