Skip to content

Category Archives: Dynamic Programming

Given an array, arr[] of size N, the task is to find the median of sums of all possible subsets of the given array. Examples:… Read More
Given an array arr[] consisting of N positive integers and the integers X and M, where 0 <= X < M, the task is to… Read More
Given a matrix arr[][] of dimensions 2 * N, the task is to maximize the sum possible by selecting at most one element from each… Read More
Given an integer X and integer N, the task is to find the number of unique paths starting from the root in N-ary tree such… Read More
Given two arrays arr[] and arr1[] of lengths N and M respectively, the task is to find the longest increasing subsequence of array arr[] such… Read More
Given an N-array tree of N nodes, rooted at 1, with edges in the form {u, v}, and an array values[] consisting of N integers.… Read More
Given an array arr[] of size N, the task is to find the total number of sequences of positive integers possible (greater than 1) whose… Read More
Given integers N and K representing the number of batches and number of students in each batch respectively, and a 2D array ratings[][] of size… Read More
Given two integers L and R, the task is to count all the numbers in the range [L, R] whose sum of digits is a… Read More
Given an array arr[] consisting of N positive integers, the task is to find the maximum length of subsequence from the given array such that… Read More
Given an array arr[] of size N, the task is to find the number of subarrays having sum of its elements equal to the number… Read More
Given the integers N, K and M, the task is to find the Kth number greater than N whose sum of digits is divisible by… Read More
Given a matrix mat[][] of dimensions N * M, the task is to print the maximum number of trailing zeros that can be obtained in the… Read More
Given three positive integers L, R, and K, the task is to find the count of numbers in the range [L, R] having K consecutive… Read More