Number of Arithmetic Triplets
You're provided with a 0-indexed, strictly increasing integer array nums and a positive integer, diff. A triplet (i, j, k) is considered an arithmetic triplet if the following conditions hold:
- i < j < k,
- nums[j] - nums[i] == diff, and
- nums[k] - nums[j] == diff.
Your task is to determine and print the number of unique arithmetic triplets in the given array.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)