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

# Tag Archives: Memoization

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 if for… Read More

Given two strings A and B of size N and M respectively, where B is a sub-sequence of A and an array arr[] of size… 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

Go to CDN’s CopyGiven three integers N, M and P, the task is to find the total number of valid arrays that can be created… Read More

Given an array A[] of size N, the task is to find the maximum score possible of this array. The score of an array is… Read More