Is the Sum of Odd Elements Odd
EasyP3Coding
Add up all the odd elements of nums. Return true if that sum is odd, otherwise false. If there are no odd elements the sum is 0, which is even.
Example 1
- Input
- nums = [1,2,3]
- Output
- false
Example 2
- Input
- nums = [1,3]
- Output
- false
Example 3
- Input
- nums = []
- Output
- false
Constraints
- 0 <= nums.length <= 10^5
- -10^9 <= nums[i] <= 10^9
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
Run checks the 3 visible tests, Submit all 10. ⌘Enter runs, ⌘⇧Enter submits.