Search
⌘K
Leetcode 446. Arithmetic Slices II - Subsequence
Count the number of arithmetic subsequences (length ≥ 3) in an array — subsequences whose consecutive differences are all equal. The typical solution uses DP with a map at each index that tracks counts of subsequences ending there by difference, extending prior pairs in O(n^2) time and O(n^2) space.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.