In the previous blog, I mentioned I would create a separate blog on the Greedy Algorithm, and here it is. This is the blog! Let's get started! What is Greedy Algorithm? Imagine a pile of both good bricks and broken pieces. Now, you are told to build ...
You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position. Return true if you can reach the last index, or false otherwise. Example...
// Input list of process execution times const input = [4, 3, 7, 1, 2]; // Function to calculate the average waiting time using SJF function averageWaitingTimeSJF(processTimes) { // Sort the process times in ascending order const sortedTimes...
At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must pr...
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor g[i], which is the minimum size of a cookie that the child will be content with; and eac...
Hello, Welcome to my July Challenge of Problem Solving and finding solutions to Leetcode's Data Structures and Algorithm questions. Here, I choose a question daily and try to solve it, and finally pen down my process of flow in solving the question. ...