Frage im Vorstellungsgespräch bei Amazon

two coding questions, one for dynamic programming, one for greedy