Navan·Software Engineer·Technical Phone Screen
- Implement a Pascal's Triangle-style DP problem where dp[i][j] = dp[i-1][j-1] + dp[i-1][j], but the 2D array causes an out-of-memory error. Solve it using O(N) space with a 1D rolling array, and explain why you must update right-to-left instead of left-to-right.
“I started with the 2D approach out of habit and the interviewer stopped me pretty quickly to say it would OOM.”