Skip to content

Tag Archives: Bitwise-XOR

Two players A and B are playing NIM Game with each other. Both are playing optimally. Player A starts the game. The task is to… Read More
Given a range [L, R], the task is to find the XOR of all the integers in the given range i.e. (L) ^ (L +… Read More
Given an array arr[] of size n. The task is to count the number of possible sub-arrays such that their elements can be re-arranged to… Read More
Given a ‘N*N’ matrix, the task is to find the XOR of XORs of all possible sub-matrices.Examples:  Input :arr = {{3, 1}, {1, 3}} Output… Read More
Given an array of N numbers, the task is to find the number of sub-arrays (size of the sub-array should be an even number) of… Read More
Given an array containing N positive integers, the task is to find the sum of XOR of all sub-arrays of the array. Examples:  Input :… Read More
Given a range [ L, R ], the task is to find if the value of XOR of all natural numbers in the range L… Read More
Given an array arr[], the task is to count the number of unordered pairs of indices (i, j) such the gcd(2, a[i]^a[j]) > 1 and… Read More
Given an array q[] of XOR queries of size N (N is a multiple of 4) which describe an array of the same size as… Read More
Prerequisite:  XOR Linked List – A Memory Efficient Doubly Linked List | Set 1 XOR Linked List – A Memory Efficient Doubly Linked List |… Read More
Given an integer n, the task is to find the number of possible values of 0 ≤ x ≤ n which satisfy n XOR x… Read More
Given an array arr[] of n elements and a number K, find the number of ordered subsets of arr[] having XOR of elements as K This… Read More
Given an array arr[], the task is to count all the valid pairs from the array. A pair (arr[i], arr[j]) is said to be valid… Read More
Given an array arr[] in which XOR of every 2 consecutive elements of the original array is given i.e if the total number of elements… Read More
Given an array arr[], the task is to count all the pairs whose xor gives the unique prime, i.e. no two pairs should give the… Read More