NVIDIA interview question

A leetcode hard type question involving trees with dynamic programming and memoization