FunctionRacerProblemsRace

Sum of Unique Elements

EasyHash mapsPython, JavaScript, TypeScript, Java, C++

Add up only the values of nums that appear exactly once in the list. Return 0 if there are none.

Example 1

nums [1,2,3,2]
returns 4

1 and 3 appear once: 4.

Example 2

nums [1,1,1,1]
returns 0

Nothing is unique.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems