Skip to content

Commit d3385e9

Browse files
committed
Maximum Count of Positive Integer and Negative Integer
1 parent f140472 commit d3385e9

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
""" https://leetcode.com/problems/maximum-count-of-positive-integer-and-negative-integer/ """
2+
3+
class Solution:
4+
def maximumCount(self, nums):
5+
negatives = 0
6+
positives = 0
7+
8+
for num in nums:
9+
if (num < 0):
10+
negatives += 1
11+
elif (num > 0):
12+
positives += 1
13+
14+
if (negatives > positives):
15+
return negatives
16+
else:
17+
return positives
18+
19+
print(Solution().maximumCount([-2,-1,-1,1,2,3]))

0 commit comments

Comments
 (0)