
nums 순회function maxSum(nums: number[]): number {
const seen = new Set()
let sum = 0
let max = -Infinity
for(const num of nums) {
max = Math.max(max, num)
if(num <= 0) continue
if(seen.has(num)) continue
seen.add(num)
sum += num
}
if(max < 0) return max
return sum
};