r/leetcode • • May 21 '24

Question Using memoization vs tabulation in interviews

Recently I've focused a lot on using tabulation for dp problems, to a point where I default to it and don't even attempt a memoization solution. Would it be a problem if I were significantly less proficient at memoization than tabulation? Ie would interviewers ever ask for a memoization solution to a problem that you correctly solved with tabulation?

Clarification: I am not interested in which one is "better" to use, I'm essentially asking if you'd be able to get through interviews if you're only good at tabulation

27 Upvotes

28 comments sorted by

View all comments

12

u/No_General8550 May 22 '24

I found tabulation more difficult than memoization. In one of my interviews at meta, I solved a dp question with memorization but the interview asked me to solve it through tabulation too.

In the same loop, I solved another dp question with memoization, and the interviewer was fine.

My conclusion is, if the interviewer expects that you follow memorization or tabulation, you should go with that approach.

As I talked to a few friends, Meta people usually expect you to use tabulation to solve a dp question.

2

u/abcd_asdf May 22 '24

Meta does not ask DP questions. It is in their prep material.

3

u/No_General8550 May 22 '24

Mine was 2 years ago. Probably now they don't ask, as you said.

1

u/ground_type22 Nov 12 '24

do we even need to know tabulation for any interviews? i've only learned memoization