Skip to content

Tag Archives: cpp-map

Given an array arr[] of N integers, the task is to find the minimum possible absolute difference between indices of a special pair. A special… Read More
Given a string str, the task is to find the substring of length K which occurs the maximum number of times. If more than one… Read More
Given a string S, the task is to print the count of substrings from a given string whose first and last characters are different. Examples:… Read More
Given an array arr[] of N integers. For each element in the array, the task is to count the possible pairs (i, j), excluding the… Read More
Given an array arr[] consisting of N integers, read every element of the array one by one and perform the following operations: If the current… Read More
Given an integer K such that there is a set of all possible perfect squares, each of length K. From this set of perfect squares,… Read More
Given a Tree having N nodes connected by N − 1 edge and a single disconnected node, the task is to find the diameters for… Read More
Given an array arr[] of size N, the task is to find the number of subarrays having the sum of its elements equal to the… Read More
Given a numeric string str, the task is to calculate the number of substrings with the sum of digits equal to their length. Examples: Input:… Read More
Given an array arr[] consisting of N integers, the task is to find the length of the smallest subarray with sum equal to K. Examples:… Read More
Given a number N and an array arr[] that consist of merging N length sequence of distinct integers any number of times maintaining the relative… Read More
Given an array A[], consisting of N elements, the task is to find the minimum number of swaps required such that array elements swapped to… Read More
Given an array A[] consisting of N integers and an integer K, the task is to find the length of the smallest subarray with sum… Read More
Given a string Str of length N, consisting of lowercase alphabets, the task is to generate a number in decreasing order of the frequency of… Read More
Given a string S, containing lowercase English alphabets, and an integer K, the task is to find any index of the string which consists of… Read More