Skip to content

Commit b95751c

Browse files
authored
Create maximum-unique-subarray-sum-after-deletion.py
1 parent 8b0387a commit b95751c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Time: O(n)
2+
# Space: O(n)
3+
4+
# hash set
5+
class Solution(object):
6+
def maxSum(self, nums):
7+
"""
8+
:type nums: List[int]
9+
:rtype: int
10+
"""
11+
mx = max(nums)
12+
return mx if mx < 0 else sum(x for x in set(nums) if x >= 0)

0 commit comments

Comments
 (0)