Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings

The Balloon Vault

Learn
Play
Prove
Problem context and objectives
Mission briefing

Dungeon strategy engineer · A robot must cross a tiled dungeon

Store enough solved tile states to plan the complete route: The Balloon Vault.

A greedy step can trap the robot; recomputing every route is too expensive.

How you win

  1. 1Recognize when Burst balloons interval DP matches the clues
  2. 2Keep this true after every move: dp[left][right] is the maximum coins from bursting only balloons strictly between the boundaries
  3. 3Reach the result within O(n cubed) time and O(n squared) space

Rules and pressure

  • Target cost: O(n cubed) time and O(n squared) space
  • State rule: dp[left][right] is the maximum coins from bursting only balloons strictly between the boundaries
Lesson 1 of 3

Live algorithm trace

Burst balloons interval DP

Complete execution
1 of 5
1
left
3
1
5
8
1
right

Pad the original values with permanent boundary ones.

1pad values with boundary ones
2grow open interval widths
3try every last balloon k
4coins = left boundary * k * right boundary
5add solved left and right intervals
6keep the maximum and return full interval
padded = [1,3,1,5,8,1]
Truth to preserve / Cost target
Truth to preserve

dp[left][right] is the maximum coins from bursting only balloons strictly between the boundaries

Cost target

O(n cubed) time and O(n squared) space

Choosing a first balloon changes its neighbors unpredictably. Choosing the final balloon inside an interval fixes both boundary multipliers, splitting the remaining work into independent left and right intervals.

Your call · What should guide every step of this algorithm?

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead