DSA Factory
All free lessons
Level 3 · Structures

Free Greedy lessons

8 lessons, about 94 minutes in all. Each teaches one idea with a visual, then gives you one problem built for it. Read the lessons here, then create a free account to solve the problems and keep your progress.

Stage 0Take the best now

  1. Making changeTake as many of the largest coin as possible before moving to smaller denominations.7 min
  2. Assign cookiesSatisfy the least greedy child with the smallest sufficient cookie.8 min
  3. Change at the chai stallGive change for ₹20 using a ₹10 and a ₹5 rather than three ₹5 to preserve flexibility.8 min
  4. Maximum units on truckLoad boxes with the highest units per box first until the truck is full.8 min

Stage 1Sort then choose

  1. Most meetings in one roomFit the greatest number of meetings into one room by always keeping the one that ends first.15 min
  2. Fewest arrows for balloonsBurst every balloon on a wall with the fewest vertical arrows, by shooting at the end of the first balloon that is still unburst.15 min
  3. Send people to two citiesFly half the people to each of two cities at the lowest total cost, by sorting people on how much cheaper city A is than city B.15 min
  4. Biggest number from partsArrange whole numbers side by side to form the biggest possible number, by sorting them with a custom rule that compares joined pairs.18 min

There’s more after this

These are the opening stages of Greedy. The full path climbs on to harder problems and a mastery test. Create a free account and we’ll keep your place.

Start the full path free