Medium
An arithmetic slice is a contiguous subarray of length at least 3 with a constant difference between consecutive elements. Return the number of arithmetic slices in nums.
Input: nums = [1,2,3,4] Output: 3
Input: nums = [1,3,5,7,9] Output: 6
Input: nums = [1,2,3,8,9,10] Output: 2