494. Bitwise OR of Adjacent Elements
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]
Now Your Turn!
Pick the correct output for the given inputInput:Â nums = [1,2,4,8]
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 2 <= nums.length <= 100
- 0 <= nums[i]Â <= 100