题主 你说的第5题 就是力扣题的1027.最长等差数列 (https://leetcode-cn.com/problems/longest-arithmetic-subsequence/) 你可以去看看相关解法😁