More Positives or Negatives

In a sorted list, negative numbers appear on the left, positive numbers on the right, and zeroes in the middle. Given an ascending sorted list nums, count the strictly negative values and the strictly positive values. Return whichever count is larger.

Примеры

Ввод
[-2, -1, -1, 1, 2, 3]
Вывод
3
Ввод
[-3, -2, -1, 0, 0, 1, 2]
Вывод
3
Ввод
[5, 20, 66, 1314]
Вывод
4

Нужно реализовать

def maximum_count(nums: list[int]) -> int:

Теги

arraybinary-searchmath
PostgreSQLv16

Le résultat de l'exécution du code s'affichera ici

Visible tests
1
Input
[-2,-1,-1,1,2,3]
Expected3
2
Input
[-3,-2,-1,0,0,1,2]
Expected3
3
Input
[5,20,66,1314]
Expected4
4
Input
[0,0,0]
Expected0
5
Input
[-1,-1,-1]
Expected3
6
Input
[3,2,1,-1,-1,-2]
Expected3
Focus radio
Paused · SomaFM · Fluid