Practice Number of Arithmetic Triplets
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Count triples of indices i < j < k in the strictly increasing nums array where nums[j] - nums[i] and nums[k] - nums[j] both equal diff.
Source: Number of Arithmetic Triplets on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [0,1,4,6,7,10], diff = 3
Output
2
# Example 2
Input
nums = [4,5,6,7,8,9], diff = 2
Output
2
Constraints
3 <= nums.length <= 200
0 <= nums[i] <= 200
1 <= diff <= 50
nums is strictly increasing.
Related LeetCode Problems
Practice more problems similar to Number of Arithmetic Triplets.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.