Module 12 of 12

Greedy Algorithms & Problem Solving Patterns

Lessons

About This Module

A greedy algorithm makes the best-looking choice at each step and never goes back. When it works, it is simple and fast, often a single pass over the data. The catch is that it only works when a local best choice leads to a global best answer, so the real skill is knowing when greedy is safe and when a problem needs dynamic programming from the previous module instead.

This module starts with what a greedy algorithm is and the properties a problem needs for it to work, with the fractional knapsack as a classic example. Jump Game then shows a greedy decision on an array: keep track of the farthest position you can reach rather than trying every path.

The second half widens from single techniques to problem-solving patterns. Two pointers and sliding window turn many nested loops into a single pass, and the final lesson surveys the core patterns that most interview problems reduce to. Choosing the right structure and pattern is the skill that ties the whole course together. Watch the lessons in order, then put it all into practice in the Projects.

Lessons

4 videos
01

Greedy Algorithms Explained

What a greedy algorithm is, how to create one, and the properties that make it work, with the fractional knapsack problem as an example.

02

Jump Game: A Foundational Greedy Problem (LeetCode 55)

A foundational greedy problem that tests reasoning about reachability and making the best decision at each step.

03

Two Pointers vs Sliding Window

The two pointers pattern and the sliding window algorithm in Python, and how each one optimizes common problems.

04

Cracking Coding Interviews: 14 Essential Patterns

An introduction to 14 coding patterns that can boost your problem-solving, helping you recognize which approach a new problem calls for.