728x90
https://leetcode.com/problems/sum-of-unique-elements
class Solution:
def sumOfUnique(self, nums: List[int]) -> int:
unique = []
for i in nums[:]:
if nums.count(i) == 1:
unique.append(i)
sum = 0
for i in unique:
sum += i
return sum
728x90
'IT > 코딩테스트' 카테고리의 다른 글
[Leetcode] 1207. Unique Number of Occurrences (0) | 2024.03.06 |
---|---|
[Leetcode] 1941. Check if All Characters Have Equal Number of Occurrences (0) | 2024.03.05 |
[Leetcode] 2405. Optimal Partition of String (0) | 2024.03.04 |
[Leetcode] 2215. Find the Difference of Two Arrays (0) | 2024.03.03 |
[Leetcode] 2418. Sort the People (0) | 2024.03.02 |