This video is part of the Greedy section under GFG SDE Sheet.
There are N piles of coins each containing Ai (1<=i<=N) coins. Find the minimum number of coins to be removed such that the absolute difference of coins in any two piles is at most K.
Note: You can also remove a pile by removing all the coins of that pile.
Example 1:
Input: N = 4, K = 0 arr[] = {2, 2, 2, 2} Output: 0 Explanation: For any two piles the difference in the number of coins is <=0. So no need to remove any coins.
Do check out:-
Problem: https://www.geeksforgeeks.org/problems/coin-piles5152/1
SDE Sheet Link: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/
Article Link: https://www.geeksforgeeks.org/remove-minimum-coins-such-that-absolute-difference-between-any-two-piles-is-less-than-k/