- Difficulty: Easy
- Tags: LeetCode, Easy, leetcode-3173, Array, O(n), O(1), 🔒, Bit Manipulation
Problem
Given an array nums
of length n
, return an array answer
of length n - 1
such that answer[i] = nums[i] | nums[i + 1]
where |
is the bitwise OR
operation.
Â
Example 1:
Input: nums = [1,3,7,15]
Output: [3,7,15]
Example 2:
Input: nums = [8,4,2]
Output: [12,6]
Example 3:
Input: nums = [5,4,9,11]
Output: [5,13,11]
Â
Constraints:
2 <= nums.length <= 100
0 <= nums[i]Â <= 100