Recognition tips

Tricks That Instantly Help in New Questions

Step 11 of 14
×

Recognition shortcuts

These small recognition rules save a surprising amount of time once the problem statement starts looking familiar but the exact recurrence is not obvious yet.

If the question asks "can we form?"

Start by thinking in boolean DP.

If the question asks "how many ways?"

Use count DP and be careful about double counting.

If the question asks for minimum or maximum

You are in optimize-DP territory, so define "best answer so far" clearly.

If it says subset plus target

Knapsack should be one of your first guesses.

If two strings appear together

Try 2D prefix DP before anything fancy.

If actions happen over time

State machine DP is usually the cleanest model.

If forward feels impossible

Reverse the process or switch to interval DP.