Dynamic Programming

Minimum Cost Tree From Leaf Values

LeetCode problem #1130

Closest Dessert Cost

LeetCode problem #1774

Dynamic Programming

Master dynamic programming patterns and optimization techniques.

Bellman-Ford Algorithm

Find shortest paths from a source vertex to all other vertices in a weighted graph, capable of handling negative edge weights

Buy and Sell Stock (Maximum Profit)

Find the maximum profit from buying and selling stock with at most one transaction

Edit Distance (Levenshtein Distance)

Find the minimum number of operations (insert, delete, replace) required to transform one string into another.

Floyd-Warshall Algorithm - All Pairs Shortest Path

Find shortest paths between all pairs of vertices in a weighted graph using dynamic programming

Jump Game

Determine if you can reach the last index of an array where each element represents the maximum jump length from that position

Jump Game II

Given an array where each element represents the maximum jump length, find the minimum number of jumps to reach the last index

Longest Palindromic Substring

Find the longest palindromic substring in a given string

Maximum Path Sum

Find the maximum path sum in a binary tree.

Maximum Subarray Sum (Kadane's Algorithm)

Find the contiguous subarray with maximum sum using Kadane's algorithm

Minimum Number of Refueling Stops

Find minimum refueling stops to reach target using greedy max-heap approach

Regular Expression Matching

Implement regular expression matching with support for '.' and '*'

Trapping Rain Water

Calculate how much rainwater can be trapped between bars of different heights

Ugly Number II (LC 264) — Min-Heap + HashSet (Medium)

What is an ugly number? Solve n-th ugly number (2,3,5) with PriorityQueue + HashSet dedupe. O(n log n). Step-by-step—practice now.

Word Break

Determine if a string can be segmented into space-separated words from a dictionary.