import functools class Solution: @functools.lru_cache(None) 当程序不断进行重复运算时,使用这个缓存器可以保存下每一次的输入和输出,避免重复运算