LeetCode solutions

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

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 5ms, memory 17.5MB, accepted 2025-12-30.

python
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)

Source