Optiver interview question

Dynamic Programming Leetcode style question