Count Even Numbers

EasyArrayMath

Description

Given an array of integers nums, return how many of them are even (divisible by two).

Examples

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

Going through the list, 3 of the numbers divide evenly by two.

Input:nums = [7,7,7]
Output:0
Explanation:

Going through the list, 0 of the numbers divide evenly by two.

Input:nums = [-4,-3,0,9,10]
Output:3
Explanation:

Going through the list, 3 of the numbers divide evenly by two.

Constraints

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

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.