Maximum weighted independent set in a path graph

Sign in to test your solution.