• Custom User Avatar

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

  • Custom User Avatar

    The description states that the condition for performing changes to the array is

    if X[i] > X[j] then X[i] = X[i] - X[j]

    for any i, j pair. 12 > 12 is false, so no changes are made to the array, which is then summed: 12 + 12 = 24 as expected.

  • Custom User Avatar

    That is just an artifact of how the test results are printed, it's not an error in your solution.

  • Custom User Avatar

    Yes. Lists, as the error states, are unhashable (because they can be mutated and thus their hash would change and that is bad).
    lru_cache's docs state:

    Since a dictionary is used to cache results, the positional and keyword arguments to the function must be hashable.