DP will be the death of me

Oscar 🐨koala
Apr 4 68 Comments

:( I feel like this is going to end my onsite. I don’t understand it. I spent the last 3 days staring at partition equal subset sum.

I don’t understand the loop... I don’t get the dp[j] part.

:/ why does a Production Engineer/SRE at facebook/Google/LinkedIn or whenever need to know DP? How often does one even encounter a DP problem? Sigh. I don’t know. I don’t get it. Feeling so defeated and want to just jump off the building or some shit. God.

I can talk about linux kernel all day long but not DP!

DP will be the death of me

comments

Want to comment? LOG IN or SIGN UP
TOP 68 Comments
  • SAP / Eng YeaNahYea
    Either they will ask dp or they wont
    Apr 4 7
    • Oscar 🐨koala
      OP
      :( I did all the above. I get 0/1 but not the variation (this partition subset). I am so upset with myself. Ugh. I feel dumb. Why do others know but not me.
      Apr 4
    • Google 🧠fry
      Yup it’s in fashion.
      Apr 4
    • Cisco MonkFerari
      You got other problems. So u r not totally dumb. Dont label yourself so just cuz of one stupid problem
      Apr 4
    • Barclays PLC FAANGHNTER
      Tushar Roy this guy solves all the ctci problems in the board. You might find some common link here . And dp sucks ass
      Apr 4
    • Seagate toti420
      If DP is the only thing standing between you the high TC, then it’s worth your while to invest time and energy and study hard. I’d love to join FAANG as a data scientist but hate the probability questions they ask. No practicing data scientist that I know has ever had to work out the probability of slipping on some fucking banana peel, but they ask these questions. They were asked, they went through it, and they’ll ask others and perpetuate the insanity. I feel your pain. BTW, interviewing process is broken in the tech industry. Don’t take it personally if you get rejected.
      Apr 5
  • Square / Eng SQ
    Double penetration does cause death
    Apr 4 2
    • Capital One / Other xTrb96
      Great minds think alike in the gutter.
      Apr 4
    • Square / Eng SQ
      Fist me, bro
      Apr 4
  • eBay soil
    DP problems should be banned
    Apr 4 2
    • HP / IT SphF25
      What does DP mean? Sorry I'm new.
      Apr 4
    • Uber
      2muchblind

      Uber

      PRE
      Apple, Microsoft
      2muchblindmore
      Dynamic programming.

      Ie, caching some stuff smartly to make the runtimes faster.
      Apr 4
  • Apple BigBootey
    If you can’t answer a simple DP question what will you say when they ask about DVDA?
    Apr 4 3
    • Oscar 🐨koala
      OP
      Sorry but what is Dvda?
      Apr 4
    • Google / Eng hooli.xyz
      If you have to ask, then you’re not ready :)
      Apr 4
    • Oscar 🐨koala
      OP
      Well... I don’t even know what you are referring to. So, if you want to help a little bro, please let me know.
      Apr 4
  • Zynga CuriousABC
    You will probably have 2 coding rounds - chances of getting DP out of 20 topics - 1/20 which is 5% chance. I'd say if you're really having a hard time with it - drop this - focus on the rest of the topics and take your chances - especially if your interview is coming up.
    Apr 4 3
    • Jet.com asd01
      Agree
      Apr 4
    • Oscar 🐨koala
      OP
      Just one round and this is why I am super sad that I am risking the chance :/ but I probably will keep dp until the end. I have plenty more to study. So you are right..
      Apr 4
    • Barclays PLC FAANGHNTER
      Stick to DP , interviewers like it.
      Apr 4
  • LinkedIn codejunky
    You might want to tackle ‘memoization’ first, then ‘ground-up DP’. Also another tip would be to practice in a language like Python so you can focus just on the algorithm, less on the syntax (ex in C++). Have fun!
    Apr 4 2
    • LinkedIn codejunky
      And pick up some book with theory, and try to get a very strong grip on the concepts. Then leetcode your time away lol
      Apr 4
    • Oscar 🐨koala
      OP
      Will try.... perseverance wins right..?
      Apr 4
  • Two Sigma mlplat
    I did a bunch of interviews recently and got very few DP problems. That said, go back to the basics. Factorials and Fibonacci numbers are a great start then give edit distance a try.
    Apr 4 1
    • New ehrlich
      Yes Fibonacci is super easy for dp.. start with that one
      Apr 4
  • Ness Technologies __|__
    I got fked in amazon interview due to DP as well. Good lk man
    Apr 4 1
    • Oscar 🐨koala
      OP
      Yeah :( sorry to hear that.
      Apr 4
  • Amazon BigONo
    If you get a DP question in the interview. Call that shit out immediately and voice your struggles. Talk/walk through what you know and make it a learning experience. "Oh! I'm glad you asked as that's actually one of the areas I'm currently struggling to understand. Can we walk through it together?"

    It may end up in a downlevel type scenario, but it'll go a hell of a lot farther with making an impact than trying to stumble your way through it.
    Apr 4 2
    • Uber
      2muchblind

      Uber

      PRE
      Apple, Microsoft
      2muchblindmore
      Wow this is so smart. Work with the system, not against it 😂
      Apr 4
    • Oscar 🐨koala
      OP
      Lol I will keep talking for 30 mins and walk out without a solution. Nice advice though in general.
      Apr 4
  • Google / Eng hooli.xyz
    That’s what she said.
    Apr 4 0
  • Jet.com asd01
    Have you tried the course from educative.io ?
    Apr 4 4
    • Oscar 🐨koala
      OP
      I read that website and still far from understanding. I will keep trying...
      Apr 4
    • Jet.com asd01
      It’s ironic coz Oscar DP’ed me in phone and onsite interviews.
      I’d say focus on top down approaches and then optimize to bottom up. It’s always easier to understand what’s going on that way, you will see the pattern over time and just be able to jump bottom up right away
      Apr 4
    • Oscar 🐨koala
      OP
      The truth is when I got my job we had a separate interview track than SWE. So I was lucky to get into Oscar. So...
      Apr 4
    • Jet.com asd01
      Don’t worry. I wasn’t ever to understand at all DP until following shit ton of tutorials and going through lots of exercises. It takes time but you will get it
      Apr 4
  • Uber msitn
    This is easy. Anyone with a CS degree should know this.
    Apr 4 3
    • Oscar 🐨koala
      OP
      I guess I am a failure then.
      Apr 4
    • Uber msitn
      No. What I meant is it's not that hard to practice and pick up. You can do it.
      Apr 4
    • Barclays PLC FAANGHNTER
      this is not CS. It's more closer to some mathematics.
      Apr 4
  • Google / Eng
    GCoin

    Google Eng

    PRE
    Apple
    GCoinmore
    I messed up my DP question at Google and here I am :)
    Apr 4 1
  • Uber
    2muchblind

    Uber

    PRE
    Apple, Microsoft
    2muchblindmore
    DP is just one of those things that takes a long time to wrap your head around.

    Once you solve the first few problems, you get the hang of it. But the first peak is pretty steep.
    Apr 4 1
    • Oscar 🐨koala
      OP
      Will keep trying but gonna table it for a few days first.
      Apr 4
  • Microsoft avR
    Putting true in index 0 of dp? Dp[-1] returns last value of dp? Right?
    Apr 4 1
    • SAP / Eng YeaNahYea
      Zero number always equals to sum 0, hence true.
      Apr 4
  • Nokia / Eng yappaa
    Keep at it koala. Practise enough to understand the pattern. You most probably won't get some unknown question on dp. It sucks though.
    Apr 4 0
  • FactSet / Eng
    Loci55

    FactSet Eng

    PRE
    Salesforce
    BIO
    New grad software Engineer in NYC. Graduated - May 2017 (Bachelors)
    Loci55more
    Get EPI (elements of programming interviews) and try interviewcake.com. Those two helped with DP a ton, personally. I still don’t fully comprehend it, but the problems I’ve done, I fully understand those and can figure out minor adjustments to similar problems.
    Apr 4 0
  • Follow up: return the actual values that make up the subset?
    Apr 4 3
  • Amazon / Other y2dry3
    class Solution lol. I wonder why imperative problems are envolped in pseudo OO. Just state that OO sucks in an interview and you get the interviewer into a nice rant ;)
    Apr 4 3
    • SAP / Eng YeaNahYea
      That's probably leetcode interface
      Apr 4
    • Amazon / Other y2dry3
      If it is, it doesn't look l33t to me, rather moronic ;)
      Apr 4
    • SAP / Eng YeaNahYea
      All leetcode solutions start with class solution stub 🙄 at least for python, java, c++ etc
      Apr 4
  • Jet.com / Other
    gtfoorgtfo

    Jet.com Other

    PRE
    Starbucks
    gtfoorgtfomore
    DP is nothing compared to bike assignment problem btw
    Apr 4 1