Maximum-weight independent set problem for a path graph
问题 While taking the Algorithms: Design and Analysis II class, one of the questions asks about the maximum-weight independent set problem for a path graph. shown below is a (blurry) screenshot of the problem statement, and the corresponding lecture videos are on YouTube: https://www.youtube.com/watch?v=0awkct8SkxA https://www.youtube.com/watch?v=pLOkbHGRsv0 https://www.youtube.com/watch?v=Im_zjFkZDCY This problem can be elegantly solved by dynamic programming, with literally one line of code. a[i