leetcode413】的更多相关文章

A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same. For example, these are arithmetic sequence: 1, 3, 5, 7, 9 7, 7, 7, 7 3, -1, -5, -9 The followi…
public class Solution { public int NumberOfArithmeticSlices(int[] A) { , sum = ; ; i < A.Length; i++) ] == A[i - ] - A[i - ]) { curr += ; sum += curr; } else { curr = ; } return sum; } } https://leetcode.com/problems/arithmetic-slices/#/description…