ThoughtSpot interview question

A Binary Search Problem and a DP problem.