Bob and Beauty of the Array
Practice
4.3 (3 votes)
Basic programming
Basics of implementation
Hash maps
Implementation
Medium
Problem
71% Success 5191 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Bob is having a array A of N elements . Bob wants to determine the beauty of the array and the beauty of the array is defned as :-
Determine Bitwise OR of maximum and minimum elements of every subset of size greater than or equal to 2 and add them.
As the answer can be quite large , you have to report it by taking modulo with 1000000007 .
Input
First line of the input will contain N , denoting the number of elements of the array.
Second line will contain N spaced integers denoting elements of the array .
Constraints
\(1 \le N \le 200000\)
\(1 \le A [ I ] \le 1000\)
Output:
For each query you have to output single integer denoting beauty of the array .
Hint:
Hashing
Submissions
Please login to view your submissions
Similar Problems
Points:30
17 votes
Tags:
Basic ProgrammingImplementationMedium
2.AABBAAC
Points:30
17 votes
Tags:
ApprovedImplementationMediumOpenString Manipulation
Points:30
14 votes
Tags:
AlgorithmsApprovedMathMediumOpen
Editorial