Count of numbers whose 0th and Nth bits are set

Given a positive integer N, the task is to count the numbers that can be represented with N bits and whose 0th and Nth bits… Read More »

Find a number containing N – 1 set bits at even positions from the right

Given a positive integer N, the task is to find a number which contains (N – 1) set bits in its binary form at every… Read More »

Bitonic point in the given linked list

Given a linked list with distinct elements, the task is to find the bitonic point in the given linked list. If there is no such… Read More »

Find XOR of numbers from the range [L, R]

Given two integers L and R, the task is to find the XOR of elements of the range [L, R]. Examples :‘ Input: L =… Read More »

Check whether it is possible to convert A into B

Given two integers A and B. The task is to check whether it is possible to convert A into B by performing below operations any… Read More »

Find the minimum number of elements that should be removed to make an array good

Given an array of size N and an integer K. The array consists of only digits {0, 1, 2, 3, …k-1}. The task is to… Read More »

Number of elements from the array which are reachable after performing given operations on D

Given an array arr[] and three integers D, A and B. You start with the number D and at any time you can add or… Read More »

Print first N Mosaic numbers

Given an integer N, the task is to print first N Mosaic numbers. A Mosaic number can be expressed as follows: If N = p1a1p2a2…pkak… Read More »

Find the side of the squares which are inclined diagonally and lined in a row

Given here are n squares which are inclined and touch each other externally at vertices, and are lined up in a row.The distance between the… Read More »

Count of nodes which are at a distance X from root and leaves

Given two integers N and X, where N is the number of nodes in an almost complete binary tree. The task is to find: The… Read More »

Find the Nth term divisible by a or b or c

Given four integers a, b, c and N. The task is to find the Nth term which is divisible by either of a, b or… Read More »

Find a sequence of N prime numbers whose sum is a composite number

Given an integer N and the task is to find a sequence of N prime numbers whose sum is a composite number. Examples: Input: N… Read More »

Number of ways of writing N as a sum of 4 squares

Given a number N, the task is to find the number of ways of writing N as a sum of 4 squares. Two representations are… Read More »

Find the Nth Mosaic number

Given an integer N, the task is to find the Nth Mosaic number. A Mosaic number can be expressed as follows: If N = Aa… Read More »

Print first N terms of Lower Wythoff sequence

Given an integer N, the task is to print the first N terms of the Lower Wythoff sequence. Examples: Input: N = 5 Output: 1,… Read More »