Trains the technique from
LeetCode 1748Sum of Unique ElementsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A stamp album lists the face value of every stamp mounted in it, in mounting order, as the list faces. A face value is called a singleton when exactly one stamp in the album carries it.
Return the total of the singleton face values. A face value carried by two or more stamps contributes nothing at all, not even one copy. Return 0 when the album holds no singleton.
Example 1
Face value 8 is carried by two stamps, so it drops out. The singletons are 3 and 5, which total 8.
Example 2
Three stamps carry face value 7, so it is not a singleton. Only 2 is, and the total is 2.
Example 3
Every stamp in the album carries the same face value, so the album holds no singleton and the total is 0.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def sum_singleton_values(faces: list[int]) -> int:public int sumSingletonValues(int[] faces)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.