829. Consecutive Numbers Sum
https://leetcode.com/problems/consecutive-numbers-sum/
问有多少种等差(d == 1)数列和会是N。等差数列求和公式是m[2x + (m - 1)]/2, x是首项,m是项数。因此遍历所有可能的m即可。
Last updated
Was this helpful?
https://leetcode.com/problems/consecutive-numbers-sum/
问有多少种等差(d == 1)数列和会是N。等差数列求和公式是m[2x + (m - 1)]/2, x是首项,m是项数。因此遍历所有可能的m即可。
Last updated
Was this helpful?