Skip to content

Commit 03048a4

Browse files
committed
do daily
1 parent a1a7ec4 commit 03048a4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

my-submissions/e2529 v1.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def maximumCount(self, nums: List[int]) -> int:
3+
pos = neg = 0
4+
for n in nums :
5+
if n > 0 :
6+
pos += 1
7+
elif n < 0 :
8+
neg += 1
9+
return max(pos, neg)

my-submissions/e2529 v2 oneliner.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Solution:
2+
def maximumCount(self, nums: List[int]) -> int:
3+
return max((pos := sum(x > 0 for x in nums)), len(nums) - nums.count(0) - pos)

0 commit comments

Comments
 (0)