Revolut interview question

There was a dynamic programming question