Skip to content

Commit 94e8c61

Browse files
authored
Create bitwise-or-of-adjacent-elements.py
1 parent 5ddfb19 commit 94e8c61

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Time: O(n)
2+
# Space: O(1)
3+
4+
# array
5+
class Solution(object):
6+
def orArray(self, nums):
7+
"""
8+
:type nums: List[int]
9+
:rtype: List[int]
10+
"""
11+
return [nums[i]|nums[i+1] for i in range(len(nums)-1)]

0 commit comments

Comments
 (0)