We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Dynamic Programming
  4. Abbreviation
  5. Discussions

Abbreviation

Problem
Submissions
Leaderboard
Discussions
Editorial

    You are viewing a single comment's thread. Return to all comments →

  • suburb4nfilth
    5 years ago+ 1 comment

    I spent a few days thinking about the problem and wanted to give some tips to those learning about dynamic programming.

    1. Try to first solve it recursively with small sample cases and then try to apply memoization. Do not start thinking about the dynamic approach because I got lost doing that and was not sure how to apply a single base case.
    2. If you do it bottom up in Python try to optimize it because it might time out (mine did on the last 2 cases).
    3. Try doing it with True and False as the values of the DP table, this way you don't have to think about numbers and edit distances and stuff.

    Hope this helps!

    31|
    Permalink
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature