Search
⌘K

Leetcode 2529. Maximum Count of Positive Integer and Negative Integer

Given a non-decreasing sorted array, return the larger of the counts of positive and negative numbers (zeros are ignored). Because the array is sorted, you can compute these counts in O(log n) by binary-searching the boundaries between negative/zero/positive regions.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.