public class Solution {
public int SumOfUnique(int[] nums) {
var hs =
from n in nums
group n by n into g
where g.Count() == 1
select g.Key;
return hs.Sum();
}
}
Source: https://leetcode.com/problems/sum-of-unique-elements/submissions/
"Simplicity can't be bought later, it must be earned from the start" -- DB
Monday, April 5, 2021
Leetcode Everyday: 1748. Sum of Unique Elements. Easy
Subscribe to:
Comments (Atom)