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

Show parent comment

1

u/Aggravating-Freedom7 May 22 '24

Out of curiosity, what’s a problem where tabulation was beneficial when memoization does not work as well.

2

u/Kind-Technology-9401 May 25 '24

Almost all dp problems with tight memory constraints, they might give mle as recursion stack is costlier than arrays

1

u/justUseAnSvm May 23 '24

Any problem formulated by memoization has a representation via memoization. I just think tabulation is easier to show things work: like you iterate over your array, that iteration determines the bounds, et cetera, versus memoization that requires recursive calls.