# Hash

### Count of distinct integers belonging to first N terms of at least one of given GPs

Given two Geometric Progressions (a1, r1) and (a2, r2) where (x, y) represents GP with initial term x and common…

### Find longest subarray with Prime sum in given Array

#include using namespace std;  void SieveOfEratosthenes(    vector& prime, int total_sum){                    for (int i = 0; i

### Construct a Graph from size of components for each node

#include using namespace std;  int constructConnectedComponent(int A[], int N){              bool flag = false;                  map mp;    for (int i = 0; i < N; 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…

### Check if a pair of strings exists that starts with and without the character K or not

Given an array arr[] consisting of N strings of lowercase characters and a character K such that any string may…

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

### Maximum Fixed Point (Value equal to index) in a given Array

Given an array arr[] of size N, the task is to find the maximum index i such that arr[i] is…

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