- 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

- cpp-map, Hash, Mathematical, Strings

Max count of N using digits of M such that 2 and 5, and, 6 and 9 can be treated as same respectively

  import java.util.HashMap;import java.util.Map;  public class GFG {                  int solve(int n, String str)    {                          HashMap mymap            = new HashMap();                  int len = str.length();                  for (int i = 0;…

Read More

- frequency-counting, Hash, Mathematical, Strings

Convert given Strings into T by replacing characters in between strings any number of times

  public class GFG {                  static String checkIfPossible(        int N, String[] arr, String T)    {                        int[] freqS = new int[256];                          int[] freqT = new int[256];                          for (char…

Read More