Courses
Tutorials
Practice
Data Structure
Java
Python
HTML
Interview Preparation
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Similar Topics
Web Technologies
37.4K+ articles
Misc
8.8K+ articles
Mathematical
7.8K+ articles
Arrays
6.5K+ articles
Competitive Programming
3.3K+ articles
Strings
3.3K+ articles
Greedy
2.1K+ articles
Algorithms
2.0K+ articles
Sorting
1.8K+ articles
Searching
1.7K+ articles
DSA
/
Algorithms
/
Greedy
Greedy
2.1K+ posts
Recent Articles
Popular Articles
Minimum steps to empty String of 'a's and 'b's
Last Updated: 31 August 2023
Given a string str consisting of only two characters 'a' and 'b', the task is to find the minimum steps required to make the string empty by removing consecutive a's and b...
read more
Strings
Greedy
DSA
Maximum number of people to be refunded with given coins
Last Updated: 31 August 2023
Given an array X[] of length N, Where X[i] for (1 ≤ i ≤ N) denotes the number of rupees we need to give to an ith person. Initially, we have P and Q numbers of coins of 1 ...
read more
Arrays
Greedy
Competitive Programming
Greedy Algorithms
DSA
Find winner in the game of Binary Array
Last Updated: 28 August 2023
Given a binary array X[] of size N. Two players A and B are playing games having the following rules, then the task is to determine the winner if B starts first and both p...
read more
Arrays
Greedy
Competitive Programming
Algorithms-Greedy Algorithms
Greedy Algorithms
Java-Competitive-Programming
DSA
Transforming an Array to an Odd Array with minimum Cost
Last Updated: 28 August 2023
Given an input array arr[], convert a given array to an 'odd array' consisting of only odd numbers. An even number can be made odd by swapping it with its adjacent element...
read more
Arrays
Greedy
DSA
Find original Array from the transformed Array
Last Updated: 24 July 2023
Given two arrays arr1[] of length N and arr2[] of length N - 1 and is built such thatarr2[i] = max(arr1[i], arr1[i+1]) for all 1 ≤ i ≤ N-1. The task is to find the origina...
read more
Arrays
Greedy
DSA
Find sum of Modulo Power till Y
Last Updated: 21 August 2023
Given three positive integers X, Y, Z. Find (X0+X1+X2+X3+X4+.......................+Xy-1) % Z.Examples:Input: X = 4, Y = 5, Z = 6Output: 5Explanation: 40+41+42+43+44 = 1+4...
read more
Greedy
DSA
Minimize operations to make Array a permutation
Last Updated: 01 August 2023
Given an array arr of n integers. You want to make this array a permutation of integers 1 to n. In one operation you can choose two integers i (0 ≤ i n) and x (x 0), the...
read more
Arrays
Greedy
Greedy Algorithms
DSA
The sum of skipped hiding spots
Last Updated: 19 October 2023
A game involving n players in a circular field with n hiding spots. The ith player starts from the hiding spot given by the expression ((k * i * i + l * i + m) % n) and ke...
read more
Binary Search
Greedy
python-set
DSA
Best order to maximise the value
Last Updated: 03 October 2023
Given, an array arr[] of N integers, the task is to select some integers from this array arr[] and arrange them in another array brr[], such that the sum of brr[i]*(i+1) f...
read more
Arrays
Greedy
DSA
Longest non-decreasing Subsequence with adjacent differences
Last Updated: 25 August 2023
Given an array arr[] of N elements, the task is to find the length of the longest non-decreasing subsequence such that the differences between adjacent elements are non-de...
read more
Dynamic Programming
Greedy
DSA
Make S into an alternate binary string by replacing any character with 0 or 1 up to K times
Last Updated: 31 July 2023
Given a string S and an integer K. You can choose any character from S and replace all occurrences of that character in S with either 0 or 1, up to K times, the task is to...
read more
Strings
Greedy
Hash
DSA
Make string S equal to T after replacing some prefix characters in S
Last Updated: 13 September 2023
Given two strings S and T of equal length consisting of lowercase characters. In one operation, it is allowed to erase the 0th character of the string S and move it to any...
read more
Strings
Binary Search
Greedy
DSA
Minimum length of X[] after removing at most K sub-arrays
Last Updated: 15 November 2023
Given an array X[] of length N and an integer K. Then your task is to output minimum length of X[] after removing at most K number of sub-arrays, which satisfies the follo...
read more
Greedy
subarray
Greedy Algorithms
DSA
Make all Array elements equal by replacing it with adjacent elements
Last Updated: 26 April 2023
Given an array A[] of size N, the task is to find the minimum number of moves required to make array elements equal where you can make adjacent elements equal in one move....
read more
Tree
Algorithms
Greedy
Greedy Algorithms
DSA
Min operations to empty an array by erasing any increasing subsequence
Last Updated: 05 July 2024
Given array A[] of size N, the task is to find the number of operations to empty the array by performing the following operation one or more times. In one operation choose...
read more
Greedy
Heap
Greedy Algorithms
priority-queue
DSA
1
...
4
5
6
...
140
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !