4009. Bitwise OR of Even Numbers in an Array
My accepted Python solution to LeetCode problem 4009, Bitwise OR of Even Numbers in an Array, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2025-12-30.
class Solution:
def evenNumberBitwiseORs(self, nums: List[int]) -> int:
result = 0
for num in nums:
if num % 2 == 0:
result |= num
return result