# frequency-counting

### Maximum count of Strings to be selected such that there is a majority character

Given an array A[]of N strings of lowercase characters, the task is to find maximum number of strings, such that…

### Form minimum number of Palindromic Strings from a given string

#include using namespace std;  int minimumPalindromicStrings(string S){        int N = S.length();                      vector freq(26);    for (int i = 0; i < N; i++) {        freq[S[i] -…

### Count pairs in an array having sum of elements with their respective sum of digits equal

Given an array arr[] consisting of N positive integers, the task is to count the number of pairs in the…

### 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…

### Generate an N-length array having GCD of all its pairs present in a given 2D array

Given a 2D array arr[][] consisting of N*N positive integers, the task is to generate an N-length array such that…

### Check if a string can be made empty by repeatedly removing given subsequence

#include using namespace std;  void findIfPossible(int N, string str){    int countG = 0, countF = 0;    for (int i = 0; i <…

### 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…

### Maximize absolute displacement from origin by moving on X-axis based on given commands

Maximize absolute displacement from origin by moving on X-axis based on given commandsGiven a string S of length N, where…