Citadel Securities interview question

Leetcode hard on Dynamic Programming