Ad
  • Custom User Avatar

    Should not be approved in current state:

    • Solution method should be top level, not inside an object
    • Printing inputs on success is pointless (especially when they're so long theres a legitimate chance of overflowing the buffer), just use assertion messages.
    • No good reason to restrict the user to returning only List, any other immutable Seq is equally valid as the task is not about working with linked lists.
  • Custom User Avatar

    You are right,I guess it was my own mistake.

  • Custom User Avatar

    Seems fine to me. Try saving your code and use the 'reset' button which should reset the tests.

  • Custom User Avatar

    Tests are messed up.

    Traceback (most recent call last):
    File "/workspace/default/.venv/lib/python3.11/site-packages/codewars_test/test_framework.py", line 112, in wrapper
    func()
    File "/workspace/default/tests.py", line 11, in test_case
    2: (s, "fat"),
    ^
    NameError: name 's' is not defined

  • Custom User Avatar

    Maybe 6 kyu. It took me some time to solve it.

  • Custom User Avatar

    That which you mention is not a Java bug.

    Comparisons between primitive types do not produce the errors you mentioned, and the "equals" method

    of Integer class compares whether they are the same object by comparing if are of the same class and their values.

    Integer equals:

    public boolean equals(Object obj) {
        if (obj instanceof Integer) {
            return value == ((Integer)obj).intValue();
        }
        return false;
    }
    

    I've solved that problem. There was a precision issue in test case.

  • Custom User Avatar

    This might be a bug on java. Some times, when using equal on the numeric objects, instead comparing the value, they compare the instances memory addresses.

  • Custom User Avatar

    Java

    Why sometimes (.2% de 100 of running test) fails?
    I have compensated for an error of 1E-10.

    sumHeight: 39.399476090834455 sumWidth: 39.399476090834455: perfect

    org.opentest4j.AssertionFailedError:
    Expected :fat
    Actual :perfect

  • Custom User Avatar

    It's fixed now, if you encountered an issue, reopen this

  • Custom User Avatar
  • Custom User Avatar

    For what language this issue addressed? If Python, i can fix this.

  • Custom User Avatar

    A solution: don't generate (near) perfect matrices.

    For example:

    num_tests = 0
    while num_tests < 100:
        matrix = random_matrix()
        width, height = ...
        if isclose(width, height):
            continue # drop this matrix
        num_tests += 1
        ... # do test
    
  • Custom User Avatar

    we have infinite decimal places

    ???

  • Custom User Avatar

    approved by

  • Custom User Avatar

    Thanks for the advice, hope it is clearer now.

  • Loading more items...