Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.3k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Strings
3.2k+ articles
Competitive Programming
2.3k+ articles
Algorithms
1.9k+ articles
Sorting
1.7k+ articles
Searching
1.7k+ articles
frequency-counting
730+ articles
array-rearrange
460+ articles
DSA
>
Algorithms
>
Greedy
Greedy
2k+ posts
Popular Articles
Recent Articles
Minimum distance between the given two words
Last Updated: 23 February 2025
Given a list of words followed by two words, the task is to find the minimum distance between the given two words in the list of words.Examp
...read more
Arrays
Strings
Greedy
Technical Scripter
Picked
Technical Scripter 2022
DSA
Minimum number of Apples to be collected from trees to guarantee M red apples
Last Updated: 10 August 2022
There are different kinds of apple trees in the four directions (East, West, North, South), which may grow both red and green apples such th
...read more
Greedy
Mathematical
Puzzles
DSA
Minimum characters required to be removed to make frequency of each character unique
Last Updated: 29 March 2023
Given string str, the task is to find the minimum count of characters that need to be deleted from the string such that the frequency of eac
...read more
Strings
Queue
Greedy
Hash
cpp-unordered_map
frequency-counting
priority-queue
DSA
Similar Topics
DSA
22.3k+ articles
Mathematical
7.7k+ articles
Arrays
6.4k+ articles
Strings
3.2k+ articles
Competitive Programming
2.3k+ articles
Algorithms
1.9k+ articles
Sorting
1.7k+ articles
Searching
1.7k+ articles
frequency-counting
730+ articles
array-rearrange
460+ articles
Convert Unix timestamp to DD/MM/YYYY HH:MM:SS format
Last Updated: 06 October 2022
Given a Unix Timestamp T (in seconds) for a given point in time, the task is to convert it to human-readable format (DD/MM/YYYY HH:MM:SS)Exa
...read more
Algorithms
Greedy
Mathematical
date-time-program
C++ Programs
Maths
DSA
Maximum items that can be bought from the cost Array based on given conditions
Last Updated: 18 February 2022
Given an array arr[] of size N where every index in the array represents the cost of buying an item and two numbers P, K. The task is to fin
...read more
Arrays
Greedy
Sorting
prefix-sum
DSA
Sum of all numbers in the given range which are divisible by M
Last Updated: 03 January 2023
Given three numbers A, B and M such that A B, the task is to find the sum of numbers divisible by M in the range [A, B].Examples:Input: A =
...read more
Greedy
Mathematical
Number Divisibility
series-sum
arithmetic progression
DSA
Huffman Coding using Priority Queue
Last Updated: 20 March 2023
Prerequisite: Greedy Algorithms | Set 3 (Huffman Coding), priority_queue::push() and priority_queue::pop() in C++ STLGiven a char array ch[]
...read more
Algorithms
Greedy
priority-queue
DSA
Maximum number of teams that can be formed with given persons
Last Updated: 23 June 2022
Given two integers N and M which denote the number of persons of Type1 and Type2 respectively. The task is to find the maximum number of tea
...read more
Greedy
Mathematical
Competitive Programming
DSA
Prim's Algorithm (Simple Implementation for Adjacency Matrix Representation)
Last Updated: 31 August 2022
We have discussed Prim's algorithm and its implementation for adjacency matrix representation of graphs.As discussed in the previous post, i
...read more
Misc
Algorithms
Greedy
Matrix
C Programs
DSA
Optimal Storage on Tapes
Last Updated: 25 April 2023
Given[Tex]n[/Tex]programs stored on a computer tape and length of each program[Tex]i[/Tex]is[Tex]L_i[/Tex]where[Tex]1=i=n[/Tex], find the or
...read more
Algorithms
Greedy
C++
C++ Programs
DSA
Maximum sum of absolute difference of any permutation
Last Updated: 27 March 2023
Given an array, we need to find the maximum sum of the absolute difference of any permutation of the given array.Examples:Input : { 1, 2, 4,
...read more
Arrays
Greedy
Sorting
DSA
Problem Solving for Minimum Spanning Trees (Kruskal’s and Prim’s)
Last Updated: 04 October 2018
Minimum spanning Tree (MST) is an important topic for GATE. Therefore, we will discuss how to solve different types of questions based on MS
...read more
Misc
Greedy
MST
GATE CS
DSA
Buy Maximum Stocks if i stocks can be bought on i-th day
Last Updated: 25 October 2024
In a stock market, there is a product with its infinite stocks. The stock prices are given for N days, where arr[i] denotes the price of the
...read more
Greedy
DSA
Minimum edges to reverse to make path from a source to a destination
Last Updated: 25 March 2025
Given a directed graph with n nodes and m edges. A source node and a destination node are also given, we need to find how many ed
...read more
Graph
Greedy
Reverse
DSA
Efficient Huffman Coding for Sorted Input | Greedy Algo-4
Last Updated: 06 November 2023
We recommend to read following post as a prerequisite for this.Greedy Algorithms | Set 3 (Huffman Coding)Time complexity of the algorithm di
...read more
Huffman Coding
Greedy
encoding-decoding
DSA
First
1
2
3
4
5
6
7
8
>>
Last
First
4
5
6
7
8
9
>>
Last
First
5
6
7
8
>>
Last
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 !