# Number of Arithmetic Triplets

Easy

14

1

36.8% Acceptance

In this lab, you will implement a function `arithmeticTriplets(nums: number[], diff: number): number`

that returns the number of unique **arithmetic triplets**. Your input will be a **0-indexed, strictly increasing** integer array `nums`

and a positive integer `diff`

. A triplet `(i, j, k)`

is an **arithmetic triplet** if the following conditions are met:

`i < j < k`

`nums[j] - nums[i] == diff`

`nums[k] - nums[j] == diff`

Your task is to return the *number of unique arithmetic triplets.*

**Example:**

`arithmeticTriplets([0,1,4,6,7,10], 3) // Output: 2 // Explanation: (1, 2, 4) and (2, 4, 5) are arithmetic triplets. arithmeticTriplets([4,5,6,7,8,9], 2) // Output: 2 // Explanation: (0, 2, 4) and (1, 3, 5) are arithmetic triplets.`

**Constraints:**

`3 <= nums.length <= 200`

`0 <= nums[i] <= 200`

`1 <= diff <= 50`

`nums`

is**strictly**increasing.

To help you get started with this lab, the initial file system for the user has been provided below. Make sure to export the function `arithmeticTriplets`

.

`/** * @param {number[]} nums * @param {number} diff * @return {number} */ export const arithmeticTriplets = function(nums, diff) { };`

`{ "name": "codedamn-lab", "type": "module" }`

```
tabs: ['index.js']
terminals: ['yarn install']
```