InterviewLegend

Graphs, Grids & DP

Alex Chen32 min readUpdated 970 real interview reports

Two families share this lesson because Oracle draws from both, and together they are close to a sixth of the coding surface. The first is graph work: a grid you flood, a set of prerequisites you order. The second is dynamic programming, the table you fill one cell at a time. They look unrelated, and the room treats them as one cluster, so this lesson teaches them back to back and keeps the seam visible.

Start with the reframe that opens up the graph half. A grid cell is a node whose neighbors are the four cells around it. A course is a node whose neighbors are the courses that depend on it. Once you see the graph, the traversal follows from the question: reachability and regions want a plain flood fill, order and cycles want a topological sort. The DP half has its own reframe, which is that a hard-looking optimization is often just a small table where each entry is built from a couple of earlier ones.

The Oracle angle
Dynamic programming shows up at Oracle, so do not skip it. The loop is an easy-to-medium bar with no hard-algorithm gauntlet, which leads some candidates to bet that DP never comes. That bet loses. House Robber and the other max-non-adjacent-sum variants are among the most recurring problems in the whole loop, and two Premium questions sit right behind them. What Oracle wants is ordinary: define the state, write the transition, and set the base case cleanly on a one-dimensional table, then say why each entry only needs the ones already computed. Bring that and the DP round is a gift, because the problems stay in the standard tier.
What's inside
  • 4 problems, worked step by step
  • about 32 min

Premium lessonOracle interview guide

These took digging.

What candidates walked out with, from 20,000+ reports, forum threads behind logins and write-ups in Chinese. Then solved step by step.

100 companies. Checked every month.

Unlock all 100 companies

$49 a year · less than $1 a week · Cancel anytime

Had your Oracle interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Oracle interview guide

Know what Oracle asks before you walk in.

19 coding · 4 system design · 18 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.