1748. Sum of Unique Elements
Array, Hash Table, Counting, AMateList ·Problem Statement
link: LeetCode.cn LeetCode You are given an integer array nums. The unique elements of an array are the elements that appear exactly once in the array.
Return the sum of all the unique elements of nums.
Example:
Input: nums = [1,2,3,2]
Output: 4
Input: nums = [1,1,1,1,1]
Output: 0
Input: nums = [1,2,3,4,5]
Output: 15
Constraints: 1 <= nums.length <= 100 1 <= nums[i] <= 100
Solution Approach
Algorithm
Implement
class Solution: