Skip to content

Category Archives: Dynamic Programming

Given an array arr[] consisting of N integers and an integer K, the task is to count the number of subsequences of the given array… Read More
Given two strings S and T, both of length N and S is an anagram of string T, the task is to convert string S… Read More
Given two arrays arr1[] and arr2[] of equal length, the task is to find the maximum sum of any subset possible by selecting elements from… Read More
Given an integer K and a square matrix mat[][] of size N * N with elements from the range[1, K], the task is to count… Read More
Given an array arr[] of N non-negative integers and an integer K, the idea is to find the length of the longest subsequence having Xor… Read More
Given an array A[] of size N(1 ≤ N ≤ 105), consisting of positive integers, where the score of an index i in range [0,… 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 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 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