DP+

Advanced DP

LIS, interval DP, bitmask DP, and tree DP patterns.

0 Problems4-5 hours

Overview

Advanced DP extends beyond linear and 2D tables into interval states, bitmask states, and tree structures. These appear in harder interview rounds and competitive programming.

Complexity Summary

Time Complexity

LIS O(n log n) · Interval O(n³) · Bitmask O(2ⁿ × n)

Space Complexity

Problem-dependent

Key Patterns & Techniques

Learn the core patterns in this topic. Each block explains when to use the pattern, the intuition behind it, and a compact code example.

1

LIS

Concept

Longest Increasing Subsequence: O(n²) DP or O(n log n) patience sort

Practice questions for this pattern
2

Interval DP

Concept

dp[i][j] = answer for subarray i..j (matrix chain, burst balloons)

Practice questions for this pattern
3

Bitmask DP

Concept

state = subset of elements; dp[mask] for TSP-style problems

Practice questions for this pattern
4

Tree DP

Concept

dp[node] computed from dp[children]; rerooting technique

Practice questions for this pattern
5

Digit DP

Concept

count numbers in range satisfying digit constraints

Practice questions for this pattern
6

Profile DP

Concept

DP on column states for grid tiling problems

Practice questions for this pattern
DSA Practice Online - 150+ Coding Interview Questions | LeetCode Alternative | InstaMock - AI Mock Interview