Algorithms - longest increasing sequence of dynamic programming

Huawei has a computer examination purposes related knowledge, learning under the bar;

problem

Given an array of length N, to find a longest sequence of monotonically increasing from (not necessarily consecutive, but not chaotic sequence). For example: Given a length of the array A 6 {5, 6, 7, 1, 2, 8}, then the longest monotonically increasing sequence is {5,6,7,8}, a length of 4

 

Dynamic programming algorithm ideas:

Scanning the whole array, in order to record the longest sequence at the end of the current number of the last to find a maximum value;

Guess you like

Origin www.cnblogs.com/Alwaysblue/p/12198428.html