Deduplication - Backtracking / Dedup

https://algo.monster/problems/deduplication

This is the 3sum problem: - LeetCode

I am finding this pretty hard to follow. I think it could use some work in general. Here are a few of the things confusing me:

  1. What must be unique? nums[i], or i? In the problem statement, you say both nums[i] and later i must be unique, but I don’t think that’s what you mean.
  2. I’m confused about the layout of this question. Usually, there’s a “try it yourself” code box, and then you reduce the problem back to the core concept of this section. That doesn’t happen (but I think if you did this, the explanation would benefit).

To answer your first question: i, j, and k must be unique. That is, you cannot choose the same index twice (so if your target is 15, and nums is [5, 6, 7], you cannot choose (5, 5, 5) as your triplet). You can choose two elements that have the same value at different indices to be part of the same triplet (e.g. if nums is [-1, 0, 3, 5, -1, 2] you can have (-1, 3, -1) as one of your triplets, since you selected those values from indices 0, 2, and 4). The triplets themselves must also be unique from each other (e.g. you can not have the triplet (-1, 3, -1) twice).