Shubham and Xor
Practice
3.6 (49 votes)
Algorithms
Bubble sort algorithm
Easy
Searching
Sorting
Problem
84% Success 29149 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
You are given an array of n integer numbers \(a_1\), \(a_2\), .. ,\(a_n\). Calculate the number of pair of indices \((i,j)\) such that \(1\le i\) < \( j\le n\) and \(a_i\) xor \(a_j = 0\)
Input format
- First line: n denoting the number of array elements
- Second line: n space separated integers \(a_1\), \(a_2\), .. ,\(a_n\).
Output format
Output the required number of pairs.
Constraints
\(1\le n\le 10^6\)
\(1 \le a_i \le 10^9\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
76 votes
Tags:
AlgorithmsBasic ProgrammingBubble SortInput/OutputSorting
Points:20
137 votes
Tags:
Ad-HocEasySorting
Points:20
81 votes
Tags:
Basic ProgrammingBrute-force searchBubble sort algorithmEasySorting
Editorial