Ad
  • Custom User Avatar

    Hmm, seems this kata is in limbo. Description has multiple spelling issues. I find the names of the data structure misleading, even a Wikipedia link does not help that much. The argument to the function is a basically an array, so please use C arrays, that helps to understand what's happening.

  • Custom User Avatar

    At this point this kata is basically a duplicate of a mixture of katas:

  • Custom User Avatar

    It's not clear if the possible root to check is always the first vertex or it can be any.

  • Custom User Avatar

    Damn, it's been AGES since I've written any C code!
    I liked this kata, but I see following issues:

    • GRAPHS as a tag?
    • I find all this matrix stuff a bit... misleading? Or maybe rather distracting, as I was not even aware of such property and solved the problem using another property (namely the fact that Int(ax^n) = a/(n+1)x^(n+1)).
    • I would change "Don't forget coeficients can be negative." to "Don't forget coefficients can be negative or fractional.". I know it's very logical that in general coefficient can be any real number, but examples slightly suggest they may be just integers in this kata.
    • I don't like the fact that definite integral is equated to the "area under the curve", because without further explanation it is ambiguous: how should the area be treated in ranges where f(x) < 0? Is area also 'negative', and should be substracted? Or maybe we treat area as always positive and should be added to the result? Not being a mathematician I do not know what the formal definitions is, but for the kata I see this ambiguity as an issue.
    • Isn't using roundf a bit of a stretch? This way, both of these pass: dotest('y', 0, 1, " y^7 + 2y^4 + 1 -y^7 ", 1.4); and dotest('y', 0, 1, " y^7 + 2y^4 + 1 -y^7 ", 0.6);. My implementation can return anything between 0.5 and 1.5 and test will still pass. Isn't epsilon-based comparison better?
    • No random tests :( Maybe I will create some when translating to Java or C# ;)
    • Why floats and not doubles? With high exponents or large coefficients, precision loss may be significant enough to make valid solutions not pass the tests.
  • Custom User Avatar

    There are pictures of both directed and undirected graphs in the description, what is expected is not really clear. As I can see, the list of edges is not symmetrical, so it looks like the graphs are directed. So should it be checked that all the edges point either from or to the root?

  • Custom User Avatar

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

  • Custom User Avatar