Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] and its permutations (or… Read More

# Category Archives: Hash

Given two strings A and B, the task is to find the smallest substring of A having B as a subsequence. If there are multiple… Read More

Given a string str of size N containing all possible characters including integers. Print Kth distinct character from the starting of the given string. If… Read More

Given an array arr[] of N elements, the task is to find the length of the longest increasing subsequence whose adjacent element difference is one. … Read More

Given two arrays a[] and b[] of length N and an integer K (1 ≤ K ≤ N). All the integers in array a[] lie… Read More

Given an array arr[] of N integers, the task is to find the count of elements in the array which are present K times and… Read More

Given two strings A and B each of length N and an integer K, the task is to find if string A can be converted… Read More

Given an array arr[] containing integers. The task is to find the largest positive integer x missing from the array such that min(arr[]) < x… Read More

Count elements in Array appearing only once and don’t have its consecutive next and previous present

Given an array arr[]. The task is to count elements in the array that appears only once and it’s consecutive next (arr[i]+1) and prev (arr[I]… Read More

Given an array arr[]. The task is to minimize the number of removals to make all the elements in arr[] consecutive. Examples Input: arr[] =… Read More

Given an array arr[] of size N. The task is to find the number of sequences in which any one of the following conditions is… Read More

Given an integer array arr[] of size N and a positive integer K, the task is to count all the pairs in the array with… Read More

Given a binary string str. The task is to find the size of the set(contains unique substrings) of substrings such that if there is a… Read More

Given a N x N matrix, such that the element at the index [N/2, N/2] is missing, the task is to find the maximum integer… Read More

Given an array arr[], the task is to find the number of times the current integer has already occurred during array traversal. Examples: Input: arr[]… Read More