Ad
  • Custom User Avatar
  • Custom User Avatar

    That's because it's not square root, but cubic root of 1*2*6 (as those are three numbers).

  • Custom User Avatar

    50 of them, but the numbers itself does not say much.

  • Custom User Avatar

    Apparently it does not run fast enough if you take 1.7 seconds (where?) to pass just one test.

  • Custom User Avatar

    Do you mean something like this:

    test.it("should pass some random tests")
    import random
    for _ in range(40):
        # compute some random input
        m, n = (random.randrange(2, 11) for _ in range(2))
        matrix = [[random.randrange(-100, 101) for _ in range(n)] for _ in range(m)]
        times = random.randrange(0, 13)
    
        # compute the expected result
        expected = # I'm not going to spoil this kata
    
        # compute a string representation of the matrix
        # now before the user might change it
        matrix_str = repr(matrix)
    
        # do the actual testing
        actual = rotate_against_clockwise(matrix, times)
        test.assert_equals(actual, expected,
            "rotate_against_clockwise({}, {})".format(matrix_str, times))