Minimize the cost to split a number

Given an integer N ≥ 2, you can split the number as a sum of k integers i.e. N = k1 + k2 + …… Read More »

Print all Semi-Prime Numbers less than or equal to N

Given an integer N, the task is to print all the semi-prime numbers ≤ N. A semi-prime number is an integer which can be expressed… Read More »

Count number of trailing zeros in Binary representation of a number using Bitset

Given a number. The task is to count the number of Trailing Zero in Binary representation of a number using bitset. Examples: Input : N… Read More »

Sum of Fibonacci Numbers in a range

Given a range [l, r], the task is to find the sum fib(l) + fib(l + 1) + fib(l + 2) + ….. + fib(r)… Read More »

Find amount of water wasted after filling the tank

Given the volume V of a tank in liter. There is a pump which is filling the tank at speed of M liter per minute.… Read More »

Largest sphere that can be inscribed within a cube which is in turn inscribed within a right circular cone

Given here is a right circular cone of radius r and perpendicular height h, which is inscribed in a cube which in turn is inscribed… Read More »

Loss when two items are sold at same price and same percentage profit/loss

Given the Selling price i.e ‘SP’ of the two items each. One item is sold at ‘P%’ Profit and other at ‘P%’ Loss. The task… Read More »

Maximize the value of the given expression

Given three non-zero integers a, b and c. The task is to find the maximum value possible by putting addition and multiplication signs between them… Read More »

Maximize the median of the given array after adding K elements to the same array

Given an array arr[] of N elements and an integer K where K < N. The task is to insert K integer elements to the… Read More »

Largest number N which can be reduced to 0 in K steps

Given an integer N. The following tasks are performed: The number is noted. The leading digit from N is subtracted from N and the resulting… Read More »

Find 2^(2^A) % B

Given two integers A and B, the task is to calculate 22A % B. Examples: Input: A = 3, B = 5 Output: 1 223… Read More »

Smallest index in the given array that satisfies the given condition

Given an array arr[] of size N and an integer K, the task is to find the smallest index in the array such that: floor(arr[i]… Read More »

Sort elements of the array that occurs in between multiples of K

Given an array arr[] and an integer K. The task is to sort the elements that are in between any two multiples of K. Examples:… Read More »

Find the value of XXXX…..(N times) % M where N is large

Given three integers X, N and M. The task is to find XXX…(N times) % M where X can be any digitfrom the range [1,… Read More »

Find the smallest number X such that X! contains at least Y trailing zeros.

Given an integer Y, find the smallest number X such that X! contains at least Y trailing zeros. Prerequisites – Count trailing zeroes in factorial… Read More »