seen of size 201 (since 0 <= nums[i] <= 200) to keep track of which numbers have been seen in the input array.res to 0.n in the input array nums.n is greater than or equal to 2 * diff, check if seen[n - diff] and seen[n - 2 * diff] are both true.true, increment res by 1.seen[n] as true.res.