Arithmetic Slices (LeetCode 413): count arithmetic subarrays. Asked in the DSA stage.
Given an integer array nums, return the number of contiguous subarrays of length at least 3 where the difference between consecutive elements is constant.
Implement:
def numberOfArithmeticSlices(nums):
Return an integer count.
def numberOfArithmeticSlices(nums):