## Convert a Decimal number to its representation

Given a decimal number, convert that number to its binary representation. Example:  Number: 5, binary representation: 101 Number: 8, binary … Read more

## Find the number of pairs with odd XOR

Given an array of integers, write a program to find the number of pairs for which the XOR is an … Read more

## Hamming Distance between two given integers

Objective: Given two integers, write an algorithm to calculate the hamming distance between the integers.  Hamming Distance: Hamming distance between … Read more

## Number’s Complement – 2 Approaches

Objective: Given a number N, write a program to find a complement number of the given number. Flip all the … Read more

## Count Set bits in a given Number

Objective: Given a Number, find all the set bits in that number. Example: Number: 23 Set bits: 4 (10111) Number: … Read more

## Multiply with power of 2 without using pow() or * operator

Objective: Given a number n and k, Calculate n * k2 without using pow() or *operator. Example: N = 3, … Read more

## Check if Given Number is power of 2.

Objective: Given a number, write a program to find if number is power of two. Example: N = 5 Output: … Read more

## Swap two numbers using Bitwise XOR Operator

Objective– Given two numbers, swap both the numbers using XOR operators. Example: X = 4, Y = 8 Output: X … Read more

## Divide with power of 2 without using pow() or / operator

Objective: Given a number n and k, Calculate n / k2 without using pow() or / operator. Example: N = … Read more

## Left Shift (<<) and Right Shift (>>) Operators

What is Left Shift (<<) Operator: a<<b means left shift the bits of number a by b places. 3<<2 means … Read more

## Convert Number to base 3 String Representation

Objective: Given a number convert it to base 3 representation. Example: N = 35 Base 3 representation: 1022 N = … Read more

## Find two non-repeating numbers in an array in O(n) time and O(1) space

Objective:  Given an array of integers which has all the repeating numbers (twice) but two numbers which are non-repeating. Write an … Read more

## Number of bit to be flipped to convert one number to another.

Objec­tive:  Given two numbers x and y. write an algorithm to find the number of bits which are to be flipped … Read more

## All elements appears thrice and one element appears once. Find that element in O(n) time and O(1) space

Objec­tive:  Given an array of integers in which all the elements are appear thrice but one which appears only one. Write … Read more

## Find the only element in array which appears only once

Objec­tive: Given an array of integers, all the elements are appear twice but one element which appears only once. Write … Read more