Category Archives: Dynamic Programming

Given integers A and K, there are A boxes the first box contains K balls, the Second box contains K + 1 balls, the Third… Read More
Given arrays A[] and B[] of size N and integer M, the task is to find out the minimum operations required to collect a sum… Read More
Given non-negative integers X, Y, and Z for each M query. Given X amount of character ‘A’, Y amount of character ‘B’, and Z amount… Read More
Given integers, L and R, the task is to find the ∑f(x) for all L to R, where f(x) is defined for number as f(x)… Read More
Given integers L and R, the task is to find the number of integers in the range L to R whose bitwise OR of digits… Read More
Given an array arr[] of size N, with values either 1, 2, or 3. Traverse the array from left to right and before traversal predict… Read More
Given a matrix A[][] of size N * N, where each matrix element is either -1 or 1. One can move from (X, Y) to… Read More
Given an array of characters arr[] of size N, whose each character is either ‘&’ (Bitwise AND) or ‘|’ (Bitwise OR). there are many possible… Read More
Given two arrays arr1[] and arr2[] of size N each. Given target sum M, Choose either a[i] or b[i] for each i where (0 ≤… Read More
Given a positive integer N, the task is to find the value of F2 + F4 + F6 +………+ F2n upto N terms where Fi… Read More
The Fibonacci numbers are the numbers in the following integer sequence.0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …….. In… Read More
Given two arrays arr1[] and arr2[] each of size N, the task is to create another array of size N from these two arrays by… Read More
What is Knapsack Problem? Suppose you have been given a knapsack or bag with a limited weight capacity, and each item has some weight and… Read More
Given an array arr[] of size N describing N moves. A player standing at origin (0, 0). In the first move, the player can move… Read More
Given an array A[] with size N, Select a subsequence B = {B[1], B[2], B[3], ………B[N] } of size M from given array A[]  (N… Read More