Dynamic Programming

- Dynamic Programming, edit-distance, Mathematical, Recursion, Strings

Minimize the count of characters to be added or removed to make String repetition of same substring

                                function getMin(x, y, z) {            return Math.min(Math.min(x, y), z);        }                                function editDistance(str1, str2, m, n)        {                                 let dp = new Array(m + 1).fill(new Array(n +…

Read More

- Arrays, Dynamic Programming, Hash, Mathematical, Memoization, Recursion

Maximum number of groups that can receive fresh donuts distributed in batches of size K

import java.io.*;import java.util.*;class GFG {            static HashMap memo;                public static int dfs(int[] V,                          int left, int K)    {                        int q = 0;                                String key = Arrays.toString(V);        key…

Read More