Ctrl K

One-Off Values Total

Easy
You are given an integer array values. A one-off is a value that occurs in the array exactly once. Return the sum of all one-offs, or 0 if there are none.
Example 1
values=[6, 3, 6, 8, 2, 3] → 10

6 and 3 each appear twice. Only 8 and 2 appear once, so the sum is 10.

Example 2
values=[4, 4, 4] → 0

There are no one-off values, so the answer is 0.

Constraints
  • 1 ≤ len(values) ≤ 100
  • 1 ≤ values[i] ≤ 100
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsThe Candidate With Most Votes EasyValues One Apart EasyEven Piles of Cards EasyMatching Domino Tiles EasyWords From Letter Tiles Easy
loading Python…
Input
values=[6, 3, 6, 8, 2, 3]
Expected
10

Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.