2d dynamic Programming question

Asked atInfosys
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Ask for the exact input, output, constraints, and allowed moves/actions.
  2. 02Propose defining a 2D state only after the objective is known.
  3. 03Confirm base cases and transition dependencies.
  4. 04State that no correct implementation can be selected from the current prompt alone.

Reference answer

Then expect these follow-ups

  • Can you provide the inputs, objective, and permitted transitions?

    Tests: requirements gathering

  • How do you decide whether a problem needs 1D or 2D DP?

    Tests: state modeling

Free to read · better with Enzo

Practice this out loud with Enzo

Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.

Next question