Frage im Vorstellungsgespräch bei Citadel Securities

asked to solve a problem about dynamic programming