Skip to content

Category Archives: Greedy

Given an array A[], the task is to find the circulant matrix made by this array.  A circulant matrix is a square matrix of order… Read More
Given a circular array arr[] of size N, the task is to find the next integers of same parity for every element in arr[]. If… Read More
Given a positive number N, and a digit X, the task is to find the largest possible number by deleting one occurrence of X from… Read More
Given an array arr[] containing N email addresses with different domains, the task is to find the unique domains and their frequencies from the list… Read More
Given a binary array arr[] of size N which is starting from index 0, the task is to reach the end of the array in… Read More
Construct a string that contains a times letter ‘A’ and b times letter ‘B’ (a > b) such that the maximum continuous occurrence of a… Read More
Given an array arr[] of size N, the task is to check if it is possible to make all array elements consecutive by performing any… Read More
Given an integer M and a sorted integer array arr[] of length N containing 1 and N-1 prime numbers, each appearing just once, the task… Read More
Given an array arr[] of size N, the task is to calculate the minimum number of elements to be removed from the array such that… Read More
Given an array arr of length N of distinct numbers and an integer X, the task is to find the minimum number of elements that… Read More
Given an array arr[] of size N and three integers X, Y and K, the task is to count the number of pairs (i, j)… Read More
Given a string S of size N containing lowercase English letters, representing a phone number(all phone numbers will be 10 digits) in words, the task… Read More
Given three arrays A[], B[] and C[] of size N each and two integers X and Y, the task is to, find the minimum cost… Read More
Given a string S of length N consisting of digits and an integer K, Reduce the string by performing the following operation till the length… Read More
Given an array arr[] of positive integers of size N, the task is to divide the array into two non-empty subsets X and Y in… Read More

Start Your Coding Journey Now!