# Category Archives: Greedy

Given an array arr[] of length N, the task is to maximize the sum of all the elements of the array by performing the following… Read More
Given an array arr[] of length N, the task is to find the XOR of pairwise sum of every possible unordered pairs of the array.… Read More
Given an N x M matrix of integers and an integer K, the task is to find the size of the maximum square sub-matrix (S… Read More
Given a non-decreasing array arr[] and an integer K, the task is to remove K elements from the array such that maximum difference between adjacent… Read More
Given an array of integers arr of size N, the task is to find the minimum possible of the expression by choosing exactly K(≤ N)… Read More
Given two numbers and N and D. Apply any of two below operations to N:   add D to N change N to digitsum(N), where digitsum(N)… Read More
Given an array arr[] of length N and an integer K, the task is to count pairs in the array whose product is Kth power… Read More
Given Adjacency List representation of graph of N vertices from 1 to N, the task is to count the minimum bipartite groups of the given… Read More
Given an array arr of positive integers of size N, the task is to find the minimum cost to make this array a permutation of… Read More
Given a number N, the task is to find the number of interesting primes less than equal to N.An interesting prime is any prime number… Read More
Given a binary array arr[], the task is to find the number of operations required to remove all 1s from the adjacent left of 0s.… Read More
Pre-requisites: Graph and its representations Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) Kruskal’s Minimum Spanning Tree Algorithm | Greedy Algo-2 Given a… Read More
Given an array arr[] and a number K. The task is to find the count of the element having odd and even number of the… Read More
Given A coins of value N and B coins of value M, the task is to check if given coins can be used to pay… Read More
Given an array arr[] of even number of element N in it. The task is to form N/2 pairs such that sum of product of… Read More