{"id":"d2816cea-fb11-459e-ab44-8a44f1548d8c","name":"Xor Of Sum Of All Pairs","description":"1. You are given an array of integers.\r\n2. You have to find the XOR of sum of all pairs in the array.","inputFormat":"A number N\r\narr1\r\narr2..\r\nN numbers","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= N &lt;= 10^9\r\n1 &lt;= arr[i] &lt;= 10^9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nint solution(vector<int> &v1)\n{\n}\n\nint main()\n{\n int n;cin>>n;\n vector<int> v1(n);\n for(int i=0;i<n;++i) cin>>v1[i];\n cout<<solution(v1)<<\"\\n\";\n return 0;\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static int solution(int[] arr){\r\n //write your code here\r\n \r\n return 0;\r\n }\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n int[] arr = new int[n];\r\n for(int i = 0 ; i < n; i++){\r\n arr[i] = scn.nextInt();\r\n }\r\n System.out.println(solution(arr));\r\n }\r\n \r\n \r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"5\r\n1\r\n5\r\n2\r\n1\r\n2\r\n","sampleOutput":"10\r\n","questionVideo":"https://www.youtube.com/embed/10sMnEraOBs?end=92","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"210129c9-abee-439f-88f6-02e4b2a949b8","name":"Xor Of Sum Of All Pairs","slug":"xor-of-sum-of-all-pairs","type":1}],"next":{"id":"165ce334-74a6-4462-8967-008df17c6925","name":"Xor Of Sum Of All Pairs MCQ","type":0,"slug":"xor-of-sum-of-all-pairs-mcq"},"prev":{"id":"1cece5aa-fbba-4c43-b3ea-81af34ad2dac","name":"Pepcoder and Bits","type":3,"slug":"pepcoder-and-bits"}}}

Xor Of Sum Of All Pairs

1. You are given an array of integers. 2. You have to find the XOR of sum of all pairs in the array.

{"id":"d2816cea-fb11-459e-ab44-8a44f1548d8c","name":"Xor Of Sum Of All Pairs","description":"1. You are given an array of integers.\r\n2. You have to find the XOR of sum of all pairs in the array.","inputFormat":"A number N\r\narr1\r\narr2..\r\nN numbers","outputFormat":"Check the sample ouput and question video.","constraints":"1 &lt;= N &lt;= 10^9\r\n1 &lt;= arr[i] &lt;= 10^9","sampleCode":{"cpp":{"code":"#include<bits/stdc++.h>\nusing namespace std;\n\nint solution(vector<int> &v1)\n{\n}\n\nint main()\n{\n int n;cin>>n;\n vector<int> v1(n);\n for(int i=0;i<n;++i) cin>>v1[i];\n cout<<solution(v1)<<\"\\n\";\n return 0;\n}"},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static int solution(int[] arr){\r\n //write your code here\r\n \r\n return 0;\r\n }\r\n\tpublic static void main(String[] args) {\r\n\t\tScanner scn = new Scanner(System.in);\r\n int n = scn.nextInt();\r\n int[] arr = new int[n];\r\n for(int i = 0 ; i < n; i++){\r\n arr[i] = scn.nextInt();\r\n }\r\n System.out.println(solution(arr));\r\n }\r\n \r\n \r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"5\r\n1\r\n5\r\n2\r\n1\r\n2\r\n","sampleOutput":"10\r\n","questionVideo":"https://www.youtube.com/embed/10sMnEraOBs?end=92","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"f3e3dbef-d2b7-4f6d-b357-2ef3738e6c91","name":"Bit Manipulation For Intermediate","slug":"bit-manipulation-for-intermediate-9995","type":0},{"id":"210129c9-abee-439f-88f6-02e4b2a949b8","name":"Xor Of Sum Of All Pairs","slug":"xor-of-sum-of-all-pairs","type":1}],"next":{"id":"165ce334-74a6-4462-8967-008df17c6925","name":"Xor Of Sum Of All Pairs MCQ","type":0,"slug":"xor-of-sum-of-all-pairs-mcq"},"prev":{"id":"1cece5aa-fbba-4c43-b3ea-81af34ad2dac","name":"Pepcoder and Bits","type":3,"slug":"pepcoder-and-bits"}}}
plane

Editor


Loading...

Xor Of Sum Of All Pairs

easy

1. You are given an array of integers. 2. You have to find the XOR of sum of all pairs in the array.

Constraints

1 <= N <= 10^9 1 <= arr[i] <= 10^9

Format

Input

A number N arr1 arr2.. N numbers

Output

Check the sample ouput and question video.

Example

Sample Input

5 1 5 2 1 2

Sample Output

10

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode