Arithmetic Sequences
Given a list of integers nums, return the number of contiguous arithmetic sequences of length ≥ 3.
Constraints
n ≤ 10,000wherenis length ofnums.
https://binarysearch.com/problems/Arithmetic-Sequences
Examples
Example 1
Input
- nums =
[5, 7, 9, 11, 12, 13]
Output
- answer =
4
Explanation
We have the following arithmetic sequences:
[5, 7, 9][7, 9, 11][5, 7, 9, 11][11, 12, 13]
Leave a comment