Free written solutionNumber of Arithmetic Triplets (LeetCode 2367): Solution and Explanation
Given a strictly increasing array nums and a step diff, count the index triplets i < j < k where nums[j] - nums[i] and nums[k] - nums[j] both equal diff.
Read the intuition, approach, code and complexity →