Tag Archives: XOR

Minimum XOR Value Pair

Given an array of integers. Find the pair in an array which has minimum XOR value. Examples: Input : arr[] = {9, 5, 3} Output : 6 All pair with xor value (9 ^ 5) => 12, (5 ^ 3) => 6 , (9 ^ 3) => 10. Minimum XOR value is 6 Input :… Read More »

Count all pairs with given XOR

Given an array of +ve integers and a number x, find the number of pairs of integers in the array whose XOR is equal to x. Examples: Input : arr[] = {5, 4, 10, 15, 7, 6}, x = 5 Output : 1 Explanation : (10 ^ 15) = 5 Input : arr[] = {3,… Read More »

XOR Cipher

XOR Encryption is an encryption method used to encrypt data and is hard to crack by brute-force method, i.e generating random encryption keys to match with the correct one. Below is a simple implementation in C++. The concept of implementation is to first define a XOR – encryption key and then to perform XOR operation… Read More »

Maximum XOR value in matrix

Given a square matrix (N X N), the task is to find the maximum XOR value of a complete row or a complete column. Examples: Input : N = 3 mat[3][3] = {{1, 0, 4}, {3, 7, 2}, {5, 9, 10} }; Output : 14 We get this maximum XOR value by doing XOR of… Read More »