Find XOR of two numbers without using the XOR operator
Write a program to find the XOR of two numbers without using the XOR operator.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedWrite a program to find the XOR of two numbers without using the XOR operator.
Given an integer, compute its absolute value (abs) without branching.
This post will discuss some bit hacks/tricks on letters of the English alphabet. 1. Convert uppercase character to lowercase, 2. Convert lowercase character to uppercase, 3. Invert alphabet’s case, 4. Find a letter’s position in alphabet.
This post will discuss a few related problems related to unsetting the rightmost set bit of a number.
This post will discuss a few related problems that operate on the k’th bit of a number. 1. Turn off k’th bit in a number, 2. Turn on k’th bit in a number, 3. Check if k’th bit is set for a number, 4. Toggle the k’th bit.
In this post, we will see how to 1. Check if an integer is even or odd, 2. Detect if two integers have opposite signs or not, 3. Add one to an integer, 4. Swap two numbers without using any third variable.
Given two integers, x and n, where n is non-negative, efficiently compute the power function pow(x, n) using Divide & Conquer.
Given a set S, generate all subsets of it, i.e., find the power set of set S. A power set of any set S is the set of all subsets of S, including the empty set and S itself.
Given an integer, find its square without using multiplication and division operator. Also, the use of the power function from any programming language library is not allowed.