Skip to content

Tag Archives: Memoization

Given a tree with N node and N-1 edges and an array arr[] where arr[i] denotes the value of ith node, the task is to find… Read More
Given a string S of length N consisting of digits from ‘0’ to ‘9’ .The task is to determine the total number of possible ways… Read More
For N given cities, find how many ways a driver can traverse through them so that each town is visited exactly K times. From each… Read More
Given a string s of length N, and Q queries, each of type (K, C) where K is an integer C is a character, the… Read More
The term “Memoization” comes from the Latin word “memorandum” (to remember), which is commonly shortened to “memo” in American English, and which means “to transform… Read More
Given an undirected tree with N nodes numbered from 1 to N and an array A[] where A[i] denotes the value assigned to (i+1)th node.… Read More
Given an array arr[] of N strings, and Q queries where each of the queries contains some characters, the task is to check, for each… Read More
Given two integer arrays A[] and B[] of different length N and M respectively, the task is to choose any subsequence of same length from… Read More
 Given two arrays arrA[] and arrB[] containing N integers each. Perform the following operation any number of times (possibly zero): Select any index i (0… Read More
Given two arrays a[] and b[] and an integer K, the task is to find the length of the longest common subsequence such that sum… Read More
Given a number N, the task is to count the combinations of K numbers from 1 to N having a sum equal to N, with… Read More
Given two arrays array[] and multipliers[] of size N and M where N is always greater than equal to M. There are M operations to… Read More
Given an array arr[] consisting of permutation of the first N natural numbers, the task is to find the expected number of swaps to sort… Read More