2614. Maximum Count of Positive Integer and Negative Integer
My accepted Python solution to LeetCode problem 2614, Maximum Count of Positive Integer and Negative Integer, running in 5ms.
- Difficulty: Easy
- Python
- Runtime 5ms
- Memory 17.5MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 5ms, memory 17.5MB, accepted 2025-12-30.
class Solution:
def maximumCount(self, nums: List[int]) -> int:
pos = sum(1 for x in nums if x > 0)
neg = sum(1 for x in nums if x < 0)
return max(pos, neg)