Squarepoint Capital interview question

Two leet code style questions involving dynamic programming.