Ad
  • Custom User Avatar

    closing

  • Custom User Avatar

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

  • 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:]

  • 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.