Leetcode 2367. Number of Arithmetic Triplets
Count how many index triplets (i < j < k) in a strictly increasing array form an arithmetic progression with common difference diff, i.e., nums[j]-nums[i] == diff and nums[k]-nums[j] == diff. Equivalently, count values x in nums for which x+diff and x+2*diff also appear.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late November, 2024
Find the number of triplets (i, j, k) from three sorted arrays A, B, C of equal length N, such that the absolute difference between any two elements of the triplet is less than or equal to a given non-negative integer D. Solve in O(nlogn) time and O(1) space complexity.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.