Ad
  • Custom User Avatar
    try:
        from solution import NHI
    except:
        from solution import nhi
        nhi = NHI
    

    There could be a better way to do it but that works with the current tests.

  • Custom User Avatar

    Yes. (And 10 large random tests.)

  • Custom User Avatar

    Can I have two or more examples of the large random tests ? In Python, I see nothing when I print the input. How many large tests are there ?

    Is it possible to solve it using basic gaussian elimination ?

  • Custom User Avatar

    Nice one. Function's name is not snake case, the test framework should be imported explicitly, and the return type could be a fraction. Anyway, I'm going to approve it (and then fork it if needed) in the coming days if no one complains in the meantime.

  • Custom User Avatar

    Let's go to Mars! ^^

  • Custom User Avatar

    That wasn't present. I added a subsection about the family at the beginning of the rules where I put that information.

  • Custom User Avatar

    Thanks for beta testing it again! (Almost a week.)

  • Custom User Avatar

    I don't think so. I usually pass the tests between 4 to 6 seconds. Sometimes, rarely, it takes 8 or 9 seconds. If you think that the tests are too unbalanced, I can shrink some of them.

  • Custom User Avatar

    I was, exactly five seconds ago, going to add a note about that. The direction of a path is not important. The path 1 → 2 → 3 is the same than the path 3 → 2 → 1. That's why I chose to show paths in different directions in the sample tests.

  • Custom User Avatar

    No, but each path can have a different common ancestor. I see your point, I will think of way to make it clearer.

    Edit: I changed the formula to

    \displaystyle\sum_{\substack{p \in P}} \frac{1}{2^{L(p)}} (1 + F_{c_p})
    

    Where $c_p$ is the common ancestor of a and b on the path p.

  • Custom User Avatar

    I accommodated the tests to the new definition: there's now one path between someone and themself.

  • Custom User Avatar
    • no : if I made the things right, the tests only generate family trees with cousin marriage between persons from the same generation
    • that's what I wanted to underline with : in this kata: a person has either both a mother and a father, or neither a father nor a mother
  • Custom User Avatar

    I changed the first sentence of the rules to An ancestor of a person is either themself or any direct ascendant of that person. I also removed the sentence about the common ancestor when going down from an ancestor to some of their descendant.

    When I was doing my research, I found that there are other things to take account of when computing the coancestry of two persons for some specific cases (for example when they are ancestor-descendant in one way and cousins in another way). The note is there to inform the user that the formula is not exact for some cases. Maybe I should rephrase it.

  • Custom User Avatar

    Approved, thanks for your work and your support.

  • Custom User Avatar

    Two errors in the sample and fixed tests that I edited:

    • second describe block, third it block, in the input: "ibrahim has three daughters..." should be "ibrahim has 3 daughters..."
    • third describe, first and second it, in the input: "laozi has two sisters..." should be "laozi has 2 sisters..."
  • Loading more items...