"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
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();
}
}
No comments:
Post a Comment