Dynamic programming sequence
A. On the longest rise / fall / rise does / does not drop sequence
Such an algorithm example
- Exam: Luo Gu
- Question: 1020
- Title: missile interceptors
- link :https://www.luogu.org/problemnew/show/P1020
Note: the following algorithm chosen by the longest sequence showing the rise
1. (n 2 )
Thinking: f [i] represented by q [i] at the end of the longest sub-sequence length increase, an initial value. Per cycle 1 ~ n, recirculation 1 ~ i - 1, if q [i]> q [j] (ah to rise), it is f [i] = max (f [i], f [j] + 1 ) (this is because the 1 + plus q [i] ah)