## Count number of subsets having a particular XOR value

Given an array arr[] of n numbers and a number K, find the number of subsets of arr[] having XOR of elements as K Examples… Read More »

## Find the maximum subset XOR of a given set

Given an set of positive integers. find the maximum XOR subset value in the given set. Expected time complexity O(n). Examples: Input: set[] = {2,… Read More »

## Swap two variables in one line in C/C++, Python, PHP and Java

We have discussed different approaches to swap two integers without the temporary variable. How to swap in a single line without using library function? Python:… Read More »

## Given a set, find XOR of the XOR’s of all subsets.

The question is to find XOR of the XOR’s of all subsets. i.e if the set is {1,2,3}. All subsets are : [{1}, {2}, {3},… Read More »

## Find the maximum subarray XOR in a given array

Given an array of integers. find the maximum XOR subarray value in given array. Expected time complexity O(n). Examples: Input: arr[] = {1, 2, 3,… Read More »

## Find XOR of two number without using XOR operator

Given two integers, find XOR of them without using XOR operator, i.e., without using ^ in C/C++. Examples : Input: x = 1, y =… Read More »

## Bitwise Operators in C/C++

In C, the following 6 operators are bitwise operators (work at bit-level) & (bitwise AND) Takes two numbers as operands and does AND on every… Read More »

## How to swap two numbers without using a temporary variable?

Given two variables, x and y, swap two variables without using a third variable. Method 1 (Using Arithmetic Operators) The idea is to get sum… Read More »

Given two bit sequences as strings, write a function to return the addition of the two sequences. Bit strings can be of different lengths also.… Read More »

## Find the element that appears once

Given an array where every element occurs three times, except one element which occurs only once. Find the element that occurs once. Expected time complexity… Read More »

## Detect if two integers have opposite signs

Given two signed integers, write a function that returns true if the signs of given integers are different, otherwise false. For example, the function should… Read More »

## XOR Linked List – A Memory Efficient Doubly Linked List | Set 2

In the previous post, we discussed how a Doubly Linked can be created using only one space for address field with every node. In this… Read More »

## Find the two numbers with odd occurrences in an unsorted array

Given an unsorted array that contains even number of occurrences for all numbers except two numbers. Find the two numbers which have odd occurrences in… Read More »

## Swap bits in a given number

Given a number x and two positions (from the right side) in the binary representation of x, write a function that swaps n bits at… Read More »

## Add two numbers without using arithmetic operators

Write a function Add() that returns sum of two integers. The function should not use any of the arithmetic operators (+, ++, –, -, ..… Read More »