Adyen Interview Question

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