- Arrays, frequency-counting, Greedy

Maximize the profit after selling the tickets | Set 2 (For elements in range [1, 10^6])

                                   function maxAmount(n, k, arr)        {                                             let A = new Array(1000001).fill(0);            for (let i = 0; i < n; i++)            {                A[arr[i]]++;            }            let j = 0;                                                 for (let…

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