Ad
  • Default User Avatar

    Yeah I agree if it were to be used in the real world it would probably be better and safer to do it iteratively and do some checks so it doesn't run forever. For these small kata I find it more fun to solve them in short and interesting ways though :)

  • Default User Avatar

    In the example tests, "current list is %r"%r doesn't work. I honestly haven't used that syntax for string formatting in ages, I find that using the .format() string function a lot clearer as in: "current list is {0}".format(a)

  • Default User Avatar

    This would actually be a really good problem to help people get comfortable with recursion. Recursion was the first way I thought of solving this, I didn't realize until after submitting and seeing the other solutions that there was a constant depth to the nesting.

  • Default User Avatar

    I didn't realize that test cases can't be edited after publishing, which is unfortunate because it actually is well defined.

    dim(a + b) = max(dim(a), dim(b))

    This is because the vector space R^m is a subspace of R^n for all m <= n. For example, (1, 2) + (3, 4, 7) = (4, 6, 7) because (1, 2) = (1, 2, 0).

  • Default User Avatar

    I don't think there should be a restriction on adding and subtracting vectors of different dimension, addition of vectors of diffent dimension is valid mathematically so why not here?