## Find the root of the sub-tree whose weighted sum XOR with X is minimum

Given a tree, and the weights of all the nodes, the task is to find the root of the sub-tree whose weighted sum XOR with… Read More »

## Find the node whose xor with x gives maximum value

Given a tree, and the weights of all the nodes and an integer x, the task is to find a node i such that weight[i]… Read More »

## Create a sequence whose XOR of elements is y

Given two integers N and Y, the task is to generate a sequence of N distinct non-negative integers whose bitwise-XOR of all the elements of… Read More »

## Total pairs in an array such that the bitwise AND, bitwise OR and bitwise XOR of LSB is 1

Given an array arr[] of size N. The task is to find the number of pairs (arr[i], arr[j]) as cntAND, cntOR and cntXOR such that:… Read More »

## Find a number which give minimum sum when XOR with every number of array of integers

Given an array arr[] of non-negative integers, the task is to find an integer X such that (arr[0] XOR X) + (arr[1] XOR X) +… Read More »

## Choose X such that (A xor X) + (B xor X) is minimized

Given two integers A and B. The task is to choose an integer X such that (A xor X) + (B xor X) is minimum… Read More »

## XOR of all the nodes in the sub-tree of the given node

Given an n-ary tree and Q queries where each query consists of an integer u which denotes a node. The task is to print the… Read More »

## Minimizing array sum by applying XOR operation on all elements of the array

Given an array arr[] of N integer elements, the task is to choose an element X and apply XOR operation on every element of the… Read More »

## Print steps to make a number in form of 2^X – 1

Given a number N, there are two steps to be performed. At odd step, XOR the number with any 2^M-1, where M is chosen by… Read More »

## Find the node whose xor with x gives minimum value

Given a tree, and the weights of all the nodes and an integer x, the task is to find a node i such that weight[i]… Read More »

## Check if a number from every row can be selected such that xor of the numbers is greater than zero

Given a 2-D array of order N X M array elements, the task is to check if we can select a number from every row… Read More »

## Range Queries to Find number of sub-arrays with a given xor

Given an array arr[] of size n and q queries and an integer k. Each query consists of an index range [l, r] and the… Read More »

## Generate all binary strings of length n with sub-string “01” appearing exactly twice

Given an integer N, the task is to generate all possible binary strings of length N which contain “01” as the sub-string exactly twice. Examples:… Read More »

## Number of ways for playing first move optimally in a NIM game

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 »

## XOR of all the elements in the given range [L, R]

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 »