Ad
  • Custom User Avatar

    It would be nice if the solution didn't take 6 seconds to solve, it really made me confused that my solution was that slow, until I realised that mine wasn't the problem.

  • Custom User Avatar

    The Tao of Programming right here

  • Custom User Avatar

    I pressed "attempt" 30 times :)

  • Custom User Avatar

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

  • Custom User Avatar

    I mean, that works, but it's kind of a shitty fix.

    I feel like the best solution to this problem would be to make sure that there are at least something like 20 tests where the answers should be 1, 2, '3', and 4. Then you can leave some extra 20 tests that are fully random.

    It shouldn't be too hard to create a test for a given number of squares.

    You can even do something lazy like this:

    def make_test(number_of_squares: int) -> int:
    
        n: int = randint(10 ** 8, 10 ** 9)
    
        while sum_of_squares_sol(n) != number_of_squares:
            n = randint(10 ** 8, 10 ** 9)
    
        return n
    

    Then maybe shuffle the tests around so they can't be hardcoded.

  • Default User Avatar

    there were only 15 random tests in Python, i bumped it to 100. your and akar-0's solutions do not pass anymore, but i dont know if that's enough, your solutions only fail around 15 random tests each time

  • Custom User Avatar

    It would be better if someone fixed the issue, lol.

  • Default User Avatar

    closing then, only one issue should be kept

  • Custom User Avatar

    Yeah, it's the same, I only realized after posting.

  • Default User Avatar

    isnt that a duplicate of this issue ?

  • Custom User Avatar

    Module forbidder doesn't leak into test cases if you know what you're doing btw.

  • Custom User Avatar

    This is a really nice kata, but I feel like it could be made even harder! The current reference solution seems quite suboptimal, this can easily be done in O(n).

  • Custom User Avatar

    It looks good now; I'll approve.

    Also, I don't really expect people to write their tests like I do; it really is something just for me. I'm glad it's understandable, though.

    Thanks a lot for the translation and feedback :)

  • Custom User Avatar
    • I changed the test suite description as you asked.
    • Your code is easy to read, but for my taste a bit too cumbersome to translate "to the letter"
  • Custom User Avatar

    Well, that was pretty fast. Thanks for the translation, though.

    Most of it looks good to me; I just think in the test cases it should be ${minN} <= n <= ${maxN}, rather than ${minN} <= |n| <= ${maxN}, since n is always non-negative.

    Also, this isn't related to your translation, but is the way I write the tests hard to read for others? It's a bit convoluted with the classes and type hints, but it's easier for me since I can reuse most of it from other katas, though I never stopped to wonder if it's making translations harder.

  • Loading more items...