# Greedy

### Minimize sum of numbers required to convert an array into a permutation of first N natural numbers

Minimize sum of numbers required to convert an array into a permutation of first N natural numbersGiven an array A[] of…

### Split an array into subarrays with maximum Bitwise XOR of their respective Bitwise OR values

Split an array into subarrays with maximum Bitwise XOR of their respective Bitwise OR valuesGiven an array arr[] consisting of…

### Probability of obtaining pairs from two arrays such that element from the first array is smaller than that of the second array

import java.util.*;  class GFG {                  static double probability(int[] arr1,                              int[] arr2)    {                int N = arr1.length;                  int M = arr2.length;                  double res = 0;                          Arrays.sort(arr2);                  for (int i =…

### Minimize sum of points assigned to distinct elements present in an array

Minimize sum of points assigned to distinct elements present in an arrayGiven an array arr[] of size N, the task…

### Check if a Binary String can be split into disjoint subsequences which are equal to “010”

Check if a Binary String can be split into disjoint subsequences which are equal to “010”Given a binary string, S…

### Count characters of a string which when removed individually makes the string equal to another string

Count characters of a string which when removed individually makes the string equal to another stringGiven two strings A and…

### 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…