Click here to see the full article post
This can also be solved using dynamic programming.
@fanyike what's your DP solution?
Where is DP solution? This problem is tagged as DP problem.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.