## Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M

Given a range [L, R] and two positive integers N and M. The task is to count the numbers in the range containing only non-zero… Read More »

## Ways to form an array having integers in given range such that total sum is divisible by 2

Given three positive integers N, L and R. The task is to find the number of ways to form an array of size N where… Read More »

## Sum of XOR of all subarrays

Given an array containing N positive integers, the task is to find the sum of XOR of all sub-arrays of the array. Examples: Input :… Read More »

## DP on Trees | Set-3 ( Diameter of N-ary Tree )

Given an N-ary tree T of N nodes, the task is to calculate the longest path between any two nodes(also known as the diameter of… Read More »

## Maximum length subsequence such that adjacent elements in the subsequence have a common factor

Given an array arr[], the task is to find the maximum length of a subsequence such that the adjacent elements in the subsequence have a… Read More »

## Minimum replacements to make adjacent characters unequal in a ternary string | Set-2

Given a string of ‘0’, ‘1’ and ‘2’. The task is to find the minimum number of replacements such that the adjacent characters are not… Read More »

## Find sub-matrix with the given sum

Given an N x N matrix and two integers S and K, the task is to find whether there exists a K x K sub-matrix… Read More »

## Count of sub-sets of size n with total element sum divisible by 3

Given an integer n and a range [l, r], the task is to find the count of total sub-sets of size n with integers from… Read More »

## Make Binary Search Tree

Given an array arr[] of size N. The task is to find whether it is possible to make Binary Search Tree with the given array… Read More »

## Color N boxes using M colors such that K boxes have different color from the box on its left

Given N number of boxes arranged in a row and M number of colors. The task is to find the number of ways to paint… Read More »

## A variation of Rat in a Maze : multiple steps or jumps allowed

A variation of rat in a maze. You are given an N * N 2-D matrix shaped maze (let’s call it M), there is a… Read More »

## Maximum path sum in an Inverted triangle | SET 2

Given numbers in form of an Inverted triangle. By starting at the bottom of the triangle and moving to adjacent numbers on the row above,… Read More »

## Count no. of ordered subsets having a particular XOR value

Given an array arr[] of n elements and a number K, find the number of ordered subsets of arr[] having XOR of elements as K… Read More »

## Check if it is possible to get back to 12’0 clock only by adding or subtracting given seconds

Given N seconds. The task is to check if it is possible to start from 12’0 clock and get back to 12 only adding or… Read More »

## Find probability of selecting element from kth column after N iterations

Given a matrix M of order N*M where Mij represent the occurrence of j in row i. The task is to find the probability of… Read More »