873. Count of odd numbers in Array
Given an array of n elements. The task is to return the count of the number of odd numbers in the array.
Example 1:
Input: n=5, array = [1,2,3,4,5]
Output: 3
Explanation: The three odd elements are (1,3,5).
Example 2:
Input:Â n=6, array = [1,2,1,1,5,1]
Output: 5
Explanation: The five odd elements are one 5 and four 1's.
Now Your Turn!
Pick the correct output for the given inputInput: n=5, array = [1,3,5,7,9]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= n <= 105
- 1 <= arr[i] <= 104