# Greedy

### Minimum number of bricks that can be intersected

Given a 2D array arr[][], representing width of bricks of the same height present on a wall, the task is…

### Find the array element having minimum sum of absolute differences with all other array elements

Find the array element having minimum sum of absolute differences with all other array elementsGiven an array arr[] of size…

### Minimum replacements required to make sum of all K-length subarrays equal

Given an array arr[] consisting of N positive integers and an integer K, the task is to make the sum…

### Minimum number of jumps required to sort numbers placed on a number line

#include using namespace std;void minJumps(int w[], int l[], int n){        if (n == 1) {        cout prevElementPos)            continue;                                while (currElementPos

### Minimize sum of product of same-indexed elements of two arrays by reversing a subarray of one of the two arrays

import java.io.*;import java.util.*;  public class Main {                  static void minimumProdArray(long a[],                                 long b[], int l)    {        long total = 0;                  for (int i = 0; i…

### Count permutations of first N natural numbers having sum of adjacent elements equal to a perfect square

Count permutations of first N natural numbers having sum of adjacent elements equal to a perfect squareGiven a positive integer…

### Generate a permutation of first N natural numbers having count of unique adjacent differences equal to K

Generate a permutation of first N natural numbers having count of unique adjacent differences equal to KGiven two positive integers…

### Check if removal of a subsequence of non-adjacent elements makes the array sorted

Check if removal of a subsequence of non-adjacent elements makes the array sortedGiven a binary array arr[] of size N,…