Count Negative Numbers

EasyArray

Description

Given an array of integers nums, return how many values are strictly less than zero.

Examples

Input:nums = [-1,2,-3,4]
Output:2
Explanation:

There are 2 numbers in the list below zero.

Input:nums = [1,2,3]
Output:0
Explanation:

There are 0 numbers in the list below zero.

Input:nums = [-5,-6,0]
Output:2
Explanation:

There are 2 numbers in the list below zero.

Constraints

  • 1 ≤ nums.length ≤ 10⁴
  • -10⁹ ≤ nums[i] ≤ 10⁹

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.