Adyen interview question

Modified bellman ford dynamic programming, This is a grad level algo.