Ad
  • Custom User Avatar

    thank you for pointing out. It would've been much easier if the didn't insist 'Maybe' type.

  • Default User Avatar

    The Ruby tests allow it, I did a really silly solution as I was in such a mood and I was surprised it passed. I even calculated the even and odds individually which makes no sense obviously.

  • Custom User Avatar

    A pure brute force algorithm won't be able to pass the tests. Try to study a math pattern in the triangle to speed up your code.

  • Default User Avatar

    The ranking of 8kyu is for the whole kata. It is not possible to rank it harder for a single language.

  • Default User Avatar

    I agree, this Kata seems far too difficult for an 8kyu problem.

  • Custom User Avatar

    Nope. Proof shown below using simultaneous equations.

    Let {x = cows, y = chickens, L = legs, h = heads}
    
    animals(heads=72, legs=200)
    
    4x + 2y = L
    x +  y  = H
    -------------
    4x + 2y = 200 (1)
    2x + 2x = 144 (2)
    -------------
         2x =  56
          x =  28      (cows)
          
    Sub x = 28 into (1):
    
    200 - (4 * 28) = 2y
          88       = 2y
          44       =  y   (chickens)
    

    Your proposed answer:

    Let {x = cows, y = chickens, L = legs, H = heads}
    
    animals(heads=72, legs=200)
    
    ASSUME chickens = 36, cows = 50
    
    4x + 2y = 200 (1)
    x +  y  = 72  (2)
    --------------
    50 + 36 = 86  (sub assumed x and y into (2))
    86 != 72
    
    ∴ it is impossible
    
  • Custom User Avatar

    The initial code has been setup incorrectly, I fixed it by slightly modifying the initial code. Change "module animals where" to "module Animals where" and tell me if it works.