Bitwise OR of Even Numbers in an Array
You are given an integer array nums.
Return the bitwise OR of all even numbers in the array.
If there are no even numbers in nums, return 0.
Example 1
Input
nums = [1,2,3,4,5,6]Output
6The even numbers are 2, 4, and 6, and their bitwise OR equals 6.
Example 2
Input
nums = [7,9,11]Output
0There are no even numbers, so the result is 0.
Constraints
- 1 <= nums.length <= 100
- 1 <= nums[i] <= 100