Dsa
Bit Manipulation
Easy
Find Bitwise OR of Subarray
Given an array of integers, calculate the Bitwise OR of all the elements in each contiguous subarray. Return the maximum value of these Bitwise ORs.
Input Format:
- The first line contains an integer n (1 ≤ n ≤ 100).
- The second line contains n space-separated integers.
Output Format:
- Print the maximum Bitwise OR found.
Example Input:
4
1 2 3 4
Example Output:
7
Key concepts
bit_manipulationsubarrayor
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now