All Posts

1276 articles

dsa1 min read

House Robber II — Circular Array DP

Houses arranged in a circle: first and last are adjacent. Run linear House Robber twice: once excluding last house, once excluding first.

Read →
dsa1 min read

Maximum Subarray — Kadane's Algorithm

Find the contiguous subarray with the largest sum. Kadane's algorithm: either extend previous subarray or start fresh at current element.

Read →
dsa2 min read

Coin Change — Unbounded Knapsack DP

Find minimum coins to make amount. Unbounded knapsack DP: dp[amount] = min(dp[amount-coin]+1) over all coins. Bottom-up from 0 to amount.

Read →
Page 35 of 256