Given a string S that consists of only alphanumeric characters and dashes. The string is separated into N + 1 groups by N dashes. Also… Read More
Category Archives: Greedy
Given two arrays A[] and B[] of the same length N. the task is to find a pair (X, Y) for two numbers Ai (number… Read More
Given a string S consisting of lower case letters and an integer K, the task is to remove minimum number of letters from the string,… Read More
Given an array A[] of length N, the task is to minimize the maximum frequency of any array element by performing the following operation only… Read More
Given an array arr[] of size N. The task is to make all the array elements equal to zero by applying the minimum number of… Read More
Given an array arr[] which is of 3*N size, the task is to remove N elements and divide the whole array into two equal parts… Read More
Given two arrays, array A[] of size N and array B[] of size N-1, array A has all the positive elements and -1 for the… Read More
Given a binary string S of length N, the task is to find the minimum number of removals to segregate all the 0s and all… Read More
Given a weighted directed graph with N vertices and M edges, a source src and a destination target, the task is to find the shortest… Read More
Given an array A[] of size N. The task is to find the minimum value that should be added to the array elements to maximize… Read More
Given an array A[] of size N, the task is to check if there exists any integer that divide all the elements of that array… Read More
Given an array nums[] of length N containing non-negative integers, the task is to convert all elements from index 0 to N-2 to zero, after… Read More
Given an array arr[] of size N, determine if there exist 3 distinct indices integers, such that their sum ends in digit K. Examples: Input:… Read More
Given an array arr[] of size N, the task is to find the total number of unique pair sums possible from the array elements. Examples:… Read More
Given an array A[] of size N. An array has to be created using the given array considering the following conditions. If the index is… Read More