Dynamic Programming for Coding Interviews
eBook - ePub

Dynamic Programming for Coding Interviews

A Bottom-Up approach to problem solving

  1. English
  2. ePUB (mobile friendly)
  3. Available on iOS & Android
eBook - ePub

Dynamic Programming for Coding Interviews

A Bottom-Up approach to problem solving

Book details
Table of contents
Citations

About This Book

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 scam of some government?The Dynamic Programming solution computes 100th Fibonacci term in less than 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 of 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 explain the concepts with simple examples and then deep dives into complex DP problems.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Dynamic Programming for Coding Interviews by Meenakshi, Kamal Rawat in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Algorithms. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Notion Press
Year
2022
ISBN
9781946556707

Table of contents

  1. Title
  2. Copyright
  3. Dedication
  4. Preface
  5. Acknowledgments
  6. How to Read this Book
  7. 1 Recursion
  8. 2 How it Looks in Memory
  9. 3 Optimal Substructure
  10. 4 Overlapping Subproblems
  11. 5 Memoization
  12. 6 Dynamic Programming
  13. 7 Top-Down v/s Bottom-Up
  14. 8 Strategy for DP Question
  15. 9 Practice Questions
  16. About the Author