Interview with Kamal Rawat Author of Dynamic Programming for Coding Interviews

Dynamic Programming for Coding Interviews

Hello everyone! Happy Wednesday! We know you all can’t wait for another featured post. Today’s featured author is Kamal Rawat author of Dynamic Programming for Coding Interviews, coauthored by Meenakshi. Dynamic Programming for Coding Interviewss is one of the best selling books in Computers & Technology, and in Top 50 on Algorithms sub-category.

Kamal also wrote Searching & Sorting for Coding Interviews – one of the best selling books in Computer & Technology category and in Top 750 in Algorithms sub-category, also coauthored by Meenakshi.

We’re so excited to share with all of you our interview with Kamal! Please enjoy reading and don’t forget to share this with your friends!


Name: Kamal Rawat

Background: A software developer, Trainer, Author and an Entrepreneur. With first-hand experience of implementing full life cycle of large-scale desktop, Cloud and Mobile applications across various domains and platforms in 13 years of my IT career with companies like Microsoft, and Adobe.

Now full-time trainer running online and offline courses preparing students and professionals for Interviews of High-End Software development companies like Google, Amazon, Microsoft, etc. (

Favorite gadget: Kindle

Hobbies: Yoga, Organic Farming, Ayurveda, Indian History and International Polity.


What is your book about, and why should our readers read it?
I wanted to compute 80th term of the Fibonacci series. I wrote the rampant recursive function,

int fib(int n){

return (1==n || 2==n) ? 1 : fib(n-1) + fib(n-2);


and waited for the result. I wait… and wait… and wait…

With an 8GB RAM and an Intel i5 CPU, why is it taking so long? I terminated the process and tried computing the 40th term. It took about a second. I put a check and was shocked to find that the above recursive function was called 204,668,309 times while computing the 40th term.

More than 200 million times? Is it reporting function calls or a scam of some government?

The Dynamic Programming solution computes 100th Fibonacci term in less than a fraction of a second, with a single function call, taking linear time and constant extra memory.

A recursive solution, usually, neither pass all test cases in a coding competition nor does it impress the interviewer in an interview with a company like Google, Microsoft, etc.

The most difficult questions asked in competitions and interviews, are from dynamic programming. This book takes Dynamic Programming head-on. It first explains the concepts with simple examples and then deep dives into complex DP problems.

What, in your opinion, is the current most exciting technological advancement and why?
World is moving toward huge data, and anything that can extract meaningful information from that data or can connect related data points will stay relevant. Artificial Intelligence has a potential to consume data and enhance the human decision-making process. All major companies have either defined or in the process of defining their AI strategy.

What inspired you to write your book/s?
The existing good books on algorithms (be it of Donald Knuth or Thomas H. Cormen) are written from a research point of view. They come with a lot of mathematical equations and a strong focus on research. Having said that, they are great books and I have grown up reading and admiring them.

But, there exist a gap where we need authentic and in-depth technical books for the consumption of professionals and students in industry.

Our books are written in a language and tone of the industry. Both the concept and related problems from industry are discussed in detail at the same place.

If there’s one chapter in your book people should have read, which one should it be, and why?
In our book “Dynamic Programming for Coding Interviews“, the one chapter that every software engineer should clearly understand how recursive and non-recursive code looks inside memory.

We discussed them in detail with examples.

Similarly, In our book, “Searching and Sorting for coding interviews”, there are two chapters, one in which we discuss other searching techniques (other than linear search and binary search) and the one where we give introduction to sorting techniques and discuss case studies from C++ and Java libraries will add value to the programming acumen of software developers.

As an author, which book made the most impact on you?
There are many technical books that I greatly admire, like, The Art of Computer Programming, by Knuth, Introduction to Algorithms by Cormen, Effective C++, More Effective C++, etc.

But more than these technical books, I like reading spiritual books, with Bhagwat Geeta and Satyarth Prakash being on the top. These books have repeat value and the more they are read, the more you want to read them again.

I also like reading biographies and autobiographies, the latest one I am reading is ‘Yogi Raj’ by Sandeep Deo (biography of Yogi Adityanath).

If there’s one subject you’d like to see a book about, what would it be?
I want to read a more precise and dedicated self-help book for teachers in computer science. The attitude required to teach each subject is different. Computer science cannot be taught with the attitude and methodology applied to teaching literature and vice-versa. Having said that, some teaching traits are independent of stream and subject.

I think being a subject expert is a necessary but not sufficient condition of being a good teacher. A teacher needs to ignite the minds and develop a love about the subject in his students. A teacher should not be the I-Know-All or I-Will-Tell-You guy. That will limit the growth of students. A student may eventually become better than his teacher in the same subject, and it is a responsibility of the teacher to at least leave, if not create, that room of growth in the minds of students.

Eventually, the world of tomorrow will only be as good as the teachers of today. And frankly, we are not investing much in this area.

How big is your current code base for your biggest project? Is it a hassle to maintain?
The biggest project, I was involved in was Microsoft OneNote. It was one hell of a code base, with a lot of common modules being shared by MS Word, Powerpoint, and other products. It has all the properties of being a difficult-to-maintain code.

What would you like to ask the next author being interviewed?
Write about his experience and challenges faced while writing the book.


To our featured author, Wladston, thank you very much for the time you gave us. Thank you so much and more books for you! To our readers, as we always say, we will not be here if not for all of you, so thank you very much for following us. Please don’t forget to check our social media accounts, like and share them too.

You may also like...