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.
This comment is hidden because it contains spoiler information about the solution
The description states that the condition for performing changes to the array is
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.That is just an artifact of how the test results are printed, it's not an error in your solution.
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: