← All problemsSign in

2367. Number of Arithmetic Triplets

LeetCodeArrayHash TableTwo PointersEnumerationOpen on judge ↗

You are given 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, and - nums[k] - nums[j] == diff. Return the number of unique arithmetic triplets. Example 1: Input: nums = [0,1,4,6,7,10], diff = 3 Output: 2 Explanation: (1, 2, 4) is an ar

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start