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
DSA
22.8K+ 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
Arrays
257+ articles
Greedy Algorithms
111+ posts
Recent Articles
Popular Articles
Meeting Rooms - Room with Maximum Meetings
Last Updated: 28 April 2025
Given an integernrepresenting the number of rooms numbered from0ton - 1 and a 2D integer arraymeetings[][]wheremeetings[i]=[starti, endi]indicates that a meeting is sch...
read more
Sorting
Heap
Arrays
Greedy Algorithms
min-heap
DSA
Applications, Advantages and Disadvantages of Greedy Algorithms
Last Updated: 12 December 2024
Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy algor...
read more
Greedy Algorithms
DSA
CSES Solutions - Room Allocation
Last Updated: 24 February 2025
There is a large hotel, and N customers will arrive soon. Each customer wants to have a single room. You know each customer's arrival and departure day as timings[][] such...
read more
Heap
Competitive Programming
Greedy Algorithms
Picked
DSA
CSES Problems
Find maximum frequency of any point across all ranges
Last Updated: 12 March 2024
Given a 2D array ranges[][] of size N denoting N ranges of points. Find the maximum frequency of any point across all the ranges.Examples:Input: ranges[][] = {{1, 4}, {3, ...
read more
Greedy
Geometric
Greedy Algorithms
DSA
Is Dijkstra a greedy algorithm?
Last Updated: 13 February 2024
In the world of computer science and algorithms, there's a lot of talk about Dijkstra's algorithm and its classification as a "greedy" algorithm. In this article, we will ...
read more
Dijkstra
Graph
Algorithms
Greedy
Greedy Algorithms
DSA
Data Structures and Algorithms-QnA
Reconstructing the Array with Maximum Possible Sum by Given Operations
Last Updated: 29 January 2024
Consider an array A[] of length N. Suppose, you can create obtain B[] from A[] using below steps:Iterate N/2 times on A and follow below the step below:Insert (Ai + Ai+(N/...
read more
Arrays
Competitive Programming
Greedy Algorithms
Geeks Premier League
DSA
Geeks Premier League 2023
Furthest Reachable Tower using Blocks and Ladders
Last Updated: 26 March 2024
Given an array heights[] of size N, where heights[i] is the height of the ith tower. We are standing at the 0th tower with B blocks and L ladders and we have to reach the ...
read more
Greedy
Greedy Algorithms
priority-queue
DSA
max-heap
Maximum number that can be obtain by swapping adjacent digits of same parity
Last Updated: 20 March 2024
Given an integer N, the task is to find the maximum integer that can be obtained from the given integer such that the adjacent digits of the same parity can be swapped any...
read more
sliding-window
Arrays
Greedy Algorithms
Geeks Premier League
DSA
Sliding Window 23
Geeks Premier League 2023
Construct a square matrix such that the sum of each row and column is odd
Last Updated: 16 January 2024
Given an integer N. Then your task is to output a square matrix of length N using the numbers from the range [1, N2] such that the sum of each row and column is odd.Note: ...
read more
Matrix
Greedy Algorithms
Constructive Algorithms
Geeks Premier League
DSA
Make all Ones together by Shifting Ones.
Last Updated: 29 January 2024
Given, a binary string contains zeroes and ones. In one operation you can move one step character '1' to either left or right. Find the minimum number of operations requir...
read more
Strings
Greedy Algorithms
Scala-Arrays
DSA
Maximum area that can be saved in the given Matrix
Last Updated: 09 December 2023
Consider a matrix of N rows and M columns. Initially, there is a cell at co-ordinate (X, Y), which is blue. Then the task is to place the Yellow color in an optimal cell s...
read more
Matrix
Algorithms-Greedy Algorithms
Greedy Algorithms
Geeks Premier League
DSA
Geeks Premier League 2023
Non-Repeating Bitwise OR Permutation
Last Updated: 09 January 2024
Given an integer N (N = 3). Then the task is to output a permutation such that the bitwise OR of the previous two elements is not equal to the current element, given that ...
read more
Bit Magic
permutation
Greedy Algorithms
Bitwise-OR
Geeks Premier League
DSA
Geeks Premier League 2023
Find X such that the given expression is maximized
Last Updated: 20 December 2023
Given two integers A and B, the task is to output the maximum value of (X % B) * ((A − X) % B) by finding the appropriate value of X such that (0 = X = A). Note: If there ...
read more
Mathematical
Greedy Algorithms
Geeks Premier League
DSA
Geeks Premier League 2023
Maximum number of elements that can be taken
Last Updated: 23 December 2023
Given an array of N integers. Each i'th element increases your sum by a[i], where a[i] can be negative which may decrease your sum. You start with sum=0 and iterate the ar...
read more
Competitive Programming
Greedy Algorithms
Picked
min-heap
Geeks Premier League
DSA
Geeks Premier League 2023
Minimum Moves for adjacent stars
Last Updated: 31 December 2023
Given a string s consisting of '.' and '*', In one move you can shift '*', one index left or one index right if there is a '.' present there, the task is to make an arrang...
read more
Strings
Competitive Programming
Greedy Algorithms
Picked
Geeks Premier League
DSA
Geeks Premier League 2023
1
2
3
4
5
6
7
8
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 !