Dsa
Bit Manipulation
Medium
Aggregate Bitwise OR
You are given an array of integers. Your task is to compute the aggregate bitwise OR of all the numbers in the array and return the result.
Input:
The first line contains an integer n (1 <= n <= 1000) - the size of the array.
The second line contains n space-separated integers representing the array elements (0 <= array[i] <= 10^6).
Output:
An integer representing the aggregate bitwise OR of the elements in the array.
Example:
Input:
4
1 2 3 4
Output:
7
Explanation:
The bitwise OR of 1 (01), 2 (10), 3 (11), and 4 (100) is 7 (111).
Key concepts
bit manipulationaggregate functionsbitwise operations
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