Chef and Pairs
CodeChefOpen on judge ↗
Chef recently learned about bit, and joe ask a question to the chef that,you are given an array of N size, which contains non negative integers, The task is to calculate the number of such pairs (i, j) that i < j for which A[ i ] | A[ j ] ( here | is bitwise - OR) is strictly greater than A[ i ] & A[ j ] ( here & is bitwise - AND). Help to find the number of such pairs? ###Input:
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start