Interval-dp

2 articles

dsa1 min read

Burst Balloons — Interval DP

Maximize coins by bursting balloons. Key insight: think of last balloon burst in interval [i,j]. dp[i][j] = max coins from interval with k as last balloon.

Read →
dsa1 min read

Strange Printer — Interval DP

Minimum turns to print string where each turn prints a contiguous run of same char. Interval DP: dp[i][j] = min turns for s[i..j].

Read →