Recursive Program to find Factorial of a large number
Given a large number N, the task is to find the factorial of N using recursion....
read more
Minimum cost to empty Array where cost of removing an element is 2^(removed_count) * arr[i]
Given an array arr[], the task is to find the minimum cost to remove all elements from the array where the cost of removing an element is 2^j * arr[i]. Here, j is the number of elements that have already been removed....
read more
Find last remaining element after reducing the Array
Given an array arr[] of size N and an integer K. The task is to find the last remaining element in the array after reducing the array. The rules for reducing the array are:...
read more
Maximum repeated frequency of characters in a given string
Given a string S, the task is to find the count of maximum repeated frequency of characters in the given string S.Examples:...
read more
Maximum Bitwise OR pair from a range
Given a range [L, R], the task is to find a pair (X, Y) such that L ? X, Y ? R and (X | Y) is maximum among all the possible pairs then print the bitwise OR of the found pair.Examples:...
read more
Maximize the expression (A AND X) * (B AND X) | Bit Manipulation
Given two positive integers A and B such that A != B, the task is to find a positive integer X which maximizes the expression (A AND X) * (B AND X).Example:...
read more
Reach the numbers by making jumps of two given lengths
Given integers k, d1, d2 and an integer array arr[]. Starting from number k you are allowed to make jumps of size d1 and d2 i.e. all the possible moves from k are:...
read more
Find the number of ways to draw the last colored ball
Given an array balls[] representing the count of colored balls labeled from 1 to k, the task is to determine the number of ways to draw the last ball of color i before drawing the last ball of color i + 1 for all i from 1 to k – 1....
read more
Check if an array can be split into K consecutive non-overlapping subarrays of length M consisting of single distinct element
Given two integers M and K and an array arr[] consisting of N positive integers, the task is to check if the array can be split into K consecutive non-overlapping subarrays of length M such that each subarray consists of a single distinct element. If found to be true, then print “Yes”. Otherwise, print “No”....
read more
Count ways to tile an N – length board using tiles of specified dimensions
Given an integer N, the task is to tile a board of dimensions N * 1 the task is to count the number of ways to tile a board using tiles of dimensions 1 * 1 and 2 * 1....
read more
Construct the smallest possible Array with given Sum and XOR
Given two positive integers S and X which represents the sum and Bitwise XOR of all the elements of an array arr[]. The task is to find the elements of the array arr[]. If no such array can be generated, print -1.Examples:...
read more
Check whether an array can be made strictly decreasing by modifying at most one element
Given an array arr[] of positive integers, the task is to find whether it is possible to make this array strictly decreasing by modifying at most one element.Examples:...
read more