Articles by Tag #greedy

Browse our collection of articles on various topics related to IT technologies. Dive in and explore something new!

Bank Business Strategy Optimization

This is an interesting and challenging problem inspired by real life. (but not all) ...

Learn More 10 2Dec 1 '24

Minimum number of platforms required

Problem TC: O(nlogn) class Solution { // Function to find the minimum number of platforms...

Learn More 1 0Dec 4 '24

Huffman Encoding Algorithm Using a Greedy Approach in Java

Introduction In the realm of data compression, the Huffman Encoding algorithm stands as...

Learn More 0 1Jun 15

Maximum swap

Problem TC: O(n)O(n) O(n) SC: O(n)O(n) O(n) class Solution { public int...

Learn More 0 0Oct 17 '24

Non overlapping intervals

Problem class Solution { public int eraseOverlapIntervals(int[][] intervals) { //same...

Learn More 0 0Dec 7 '24

Jump Game II

Problem /* TC: O(n), outer loop is just for checking if r<n-1, inner loop is doing...

Learn More 0 0Oct 9 '24

Longest Happy String

Problem TC: O(nlogn) //greedily try to add char one by one, in the final string, don't try and...

Learn More 0 0Oct 16 '24

Minimum No. of arrows to burst balloons

Problem class Solution { public int findMinArrowShots(int[][] points) { //remove all...

Learn More 0 0Dec 7 '24

Merge Intervals

Merge Intervals Tc : O(nlogn) for sorting the intervals based on start time + O(n) for...

Learn More 0 0Oct 14 '24

Partition of label

Problem Tc : O(nlogn) for sorting the intervals array + O(25) for other iterations Sc :O(n) for...

Learn More 0 0Oct 14 '24

Job Scheduling Problem with Max Profit

Problem class Solution { // sort on the basis of profit in descending order and try to execute...

Learn More 0 0Dec 10 '24

Interval list intersections

Problem Tc : O(nlogn) for sorting the list + O(n) for traversal of the list Sc: O(n) for using the...

Learn More 0 0Oct 14 '24