Given an array A[] of size N(1 ≤ N ≤ 105), consistingof positive integers, where the score of an index i in range [0, N… Read More

# Category Archives: Dynamic Programming

Given an array arr[] of size N and an integer K, the task is to minimize the sum of difference between the maximum and minimum… Read More

Given two integers L and R, the task is to find the count of numbers in the range [L, R] having prime digits at prime… Read More

Given three arrays A[], B[] and C[] of size N and three positive integers X, Y, and Z, the task is to find the maximum… Read More

Given an integer N and an array maxDigit[], the task is to count all the distinct N-digit numbers such that digit i does not appear… Read More

Given three integers N, A and B, the task is to calculate the probability that the sum of numbers obtained on throwing the dice exactly… Read More

Given an array arr[] of size N, and an array Q[][] with each row representing a query of the form { X, Y }, the… Read More

Given two arrays firstArr[], consisting of distinct elements only, and secondArr[], the task is to find the length of LCS between these 2 arrays. Examples:… Read More

Given an array arr[] of size N, the task is to find a value for each index such that the value at index i is… Read More

Given two integers M and N, the task is to find the number of N-length arrays possible having non-equal adjacent elements lying in the range… Read More

Given three positive integers L, R and K, the task is to count the numbers in the range [L, R] whose product of digits is… Read More

Given a positive integer N, the task is to find the value of (22 * X), where X is the binary representation of N. Since… Read More

Given a binary string S of length N consisting of 0s, 1s, and “?”, where “?” can be replaced by either 0 or 1, the… Read More

Given a 2D matrix mat[][] of size N * M, the task is to find the median of Bitwise XOR of all possible submatrices from… Read More

Given an array arr[] of even length N and an integer K, the task is to minimize the count of replacing array elements by an… Read More