Ad
  • Custom User Avatar

    closing

  • Custom User Avatar

    This is just feedback, I might try again. The question is slightly vaguely phrased. I spent a long time working on it, only to discover that the description of roman numerals on wikipedia is subtly different. The description of roman numerals on wikipedia is that they are subtractive from the right, rather than additive from the left. This results in a difference in the number 789 ('DCCXXCVIIII' obtained by my program that works correctly on the two asserts in the test run but not this number versus the correct number given by wikipedia which is DCCLXXXIX.) It's unfortunate that I spent so much time going down the wrong road before realizing that the actual description of roman numerals is a little bit different. I realize there isn't much space to describe it. Thanks!

    S Dorsher

  • Custom User Avatar

    Use markdown formatting to post your code here. The label for C++ is cpp

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    WOW!!!! I usually have very verbose code but yours is definitely off the charts. You should take a close look to the experienced guys' solutions and learn from there. And in this particular one, you're inventing the wheel when it's already invented long time ago. You are calculating the GCD from scratch and in not an efficient way instead of using the built-in function. Python comes with batteries included so take advantage of them!!!

  • Custom User Avatar

    Few things hit me with that code

    1. Why do we use double loop? Going from top to bottom doing submatrices is enough. So we have to iterate over each element in first row only and then we can use each of those elements as "pivot" from the code.
    2. I think sign should be sign = (-1) ** i.
    3. Why do we need numpy here? If we have acces to numpy, then I think we should use. round(numpy.linalg.det(numpy.matrix(a))) but I think that defeats the purpose of a Kata :-)

    I hope my comment is helpful.

    p.s. I learnt from one of previous kata that in python if you want to remove an n'th element from an array/row you can use something like :
    row = row[:n] + row[n+1:]

  • Custom User Avatar

    Currently numpy module version is 1.14, so no lcm.

  • Default User Avatar

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

  • Custom User Avatar

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

  • Default User Avatar

    Python works fine. If you have a problem with your code, raise an question instead of an issue.

    It would be much easier to help you if you formatted your code properly with markdown: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting

    From just looking at your code, it seems like you're overcomplicating the problem. You might find it benificial just to take a step back and think about what you actually need to do to solve the kata.

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    This kata is fun because it leaves room for clever mathematically solutions. I particularly enjoy those, being a numerical programmer.