##
Calculate XOR from 1 to n.
November 13, 2016

Given a number n, the task is to find the XOR from 1 to n. Examples : Input : n = 6 Output : 7… Read More »

November 13, 2016

Given a number n, the task is to find the XOR from 1 to n. Examples : Input : n = 6 Output : 7… Read More »

Given a number n, the task is to check whether this number is a multiple of 4 or not without using +, -, * ,/… Read More »

November 11, 2016

Given a number, the task is to multiply it with 10 without using multiplication operator? Examples: Input : n = 50 Output: 500 // multiplication… Read More »

October 26, 2016

Given a positive integer n, find count of positive integers i such that 0 <= i <= n and n+i = n^i Input : n… Read More »

October 18, 2016

Given a number n, find length of the longest consecutive 1s in its binary representation. Examples: Input : n = 14 Output : 3 The… Read More »

October 11, 2016

Given a number, check whether it is even or odd. Examples: input: 2 output: even input: 5 output: odd Recommended: Please solve it on “PRACTICE… Read More »

October 7, 2016

Two strings are said to be complete if on concatenation, they contain all the 26 English alphabets. For example, “abcdefghi” and “jklmnopqrstuvwxyz” are complete as… Read More »

September 19, 2016

Given three variables, a, b and c, swap them without temporary variable. Input : a = 10, b = 20 and c = 30 Output… Read More »

September 6, 2016

Given an array of n unique integers where each element in the array is in range [1, n]. The array has all distinct elements and… Read More »

September 2, 2016

Bitset is a container in C++ Standard Template Library for dealing with data at the bit level. A bitset stores bits (elements with only two… Read More »

August 12, 2016

Consider a special family of Engineers and Doctors with following rules : Everybody has two children. First child of an Engineer is an Engineer and… Read More »

August 6, 2016

Given a number n, print first n positive integers with exactly two set bits in their binary representation. Examples: Input: n = 3 Output: 3… Read More »

August 2, 2016

Given a function rand50() that returns 0 or 1 with equal probability, write a function that returns 1 with 75% probability and 0 with 25%… Read More »

June 25, 2016

Given an array that contains odd number of occurrences for all numbers except for a few elements which are present even number of times. Find… Read More »

May 28, 2016

CRC or Cyclic Redundancy Check is a method of detecting accidental changes/errors in communication channel. CRC uses Generator Polynomial which is available on both sender… Read More »