Ad
  • Default User Avatar

    I don't think that it's one of the best solutions: here filter is called two times, so it's likely that you iterate two time on input, which is unnecessay. This can be solve with a vanilla for loop & one if.

  • Custom User Avatar

    I still have no idea what I'm expected to do. Somehow, I pass all sample tests but fail on many random tests. This means the sample tests are pretty much useless. There's nothing positive I can say about this kata, except "Good luck with it".

  • Custom User Avatar

    Peformance tag should be added , i solved it but i got timeout error because my solution is O(n) ,
    i should find another way to solve it and hate this really because im still beginner and i did not know its need a solution O(log n) :(

  • Custom User Avatar

    Ok, so I'd rather keep the current phrasing as it is and simply require the return type to be a list of length 2. I may be wrong, but I think the dicussion around this is becoming too academic. So, I think it's ok if I mark as resolved.

  • Custom User Avatar

    I'm fine If the tests only requires [0] and [1] to be possible (or some specific destructuring requirements). But currently it explicitly requires a list to be returned.

  • Custom User Avatar

    that is because our mind reads what it wants to read, not what is written

  • Custom User Avatar

    Thank you for the comment. For my response I'd like to clarify that I'd like to learn and understand the norms and best practices. So, I understand what you are saying. However, I responded earlier to the issue raised by hobovsky below. They suggested that "returns a pair of integers" is ambiguous and so I changed the problem specification to "list of length 2 of integers", and added tests to test that. It seems to me now that you are suggesting that I should revert back to the previous ambiguous specifiation and only test for deconstructability into two components. I would highly appreciare further input here as to what is a better solution between these two apparently confilicting suggestions. Thanks in advance.

  • Custom User Avatar

    Thank you very much. I can't believe I missed that typo for so long.

  • Custom User Avatar

    Description typo: "a linear equation in two unknowns is any equation of the form ax+bx=c". I believe it should be ax+by=c.

  • Custom User Avatar

    Currently the test is explicitly testing that the returned result is a list, which is pretty pointless: you're destructuring to the result anyway, and destructuring does not depend on the result being a list of length 2 (it only requires that the result is destructurable, either by index or by name); and in any language where tuple or similar things exist they are infinitely better than returning a list.

    Also, can't the test handles non-destructurable values better? It is better to just wrap the whole thing into a try-catch block than doing the above.

  • Custom User Avatar

    Thank you. I added a test to accept a list of length two and updated the description accordingly. I'm now not getting any terrible crashes on weird outputs.

  • Custom User Avatar

    and returns a pair of integers

    It's not explained how the pair is supposed to be encoded. A tuple? a list of length 2? Both seem to work, is it up to a user what they return?

    Additionally: tests crash badly when an unexpected value is returned, like None or [ ] or [0, 0, 0]. Tests should verify that the form of the result is valid before they try to use it and crash.

  • Custom User Avatar
  • Custom User Avatar

    I'm marking as resolved in order to re-publish improvements. I also think the two kata are significantly different, so the issue is actually resolved.

  • Custom User Avatar

    Because in this solution I wasn't able to calculate very big numbers, but because tests were always the same, I simply hardcoded the failing tests.

  • Loading more items...