SenseTime interview question

Two medium coding challenge on DP.