DP is easy — Part-0

Ankit

--

DP a.k.a. Dynamic Programming is a problem-solving technique wherein we break the original problem into multiple smaller subproblems and solve those subproblems to lead us solving the original problem.

You can find tons of amazing DP blogs out there but most of them just tell the slight idea behind solving a DP problem ( PS.: my personal opinion ). I believe DP should be taught in a much broadway like, we should be able to convince ourselves with questions like why are we doing a particular step, what if rather than returning a value from the final base case we simply add it to each function call etc.

There are 2 ways of solving a DP problem

  1. Recursion then Memoization ( Top-Down Approach )
  2. Iteration from base case ( Bottom-Up Approach )

In all the upcoming blogs of this series, we would be solving the problems using the Top-Down approach. The reason for choosing Top-Down over Bottom-Up is that the coder has a crystal clear idea of what each and every variable used in the DP is doing. Plus, it is generally recommended for DP beginners and interview preparation as there too the interviewer wants to see how much you are aware with the working of each and every variable you use.

We would be discussing a lot of CP problems along with a few interview problems.

The sole purpose of writing these blogs is that one learns more by teaching to someone after studying something rather than just keeping it to oneself ( again personal opinion ).

All the best for the upcoming series.

All doubts and queries would be appreciated and resolved :D.

Thanks

AnkitCode99 here….

Head-over to Part — 1

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Ankit
Ankit

Written by Ankit

Software Engineer @ Xalts || xWalmart

No responses yet