Expedia Group interview question

A basic dp problem was asked.