You can use DP and transfer it to O (n ^ 2).
Let the input be x1, x2, ..., xn
Let f1, f2, ..., fn be the length of the longest ascending sequence, starting from the ith element. Initialize all of them to 1.
Now
for i = n-1, n-2, .... , 1:
for j = i,i+1,...,n:
if x[i]<x[j]:
fi=max(fi, fj+1)
, g1, g2,..., gn, gi - , . gis NULL.
for i = n-1, n-2, .... , 1:
for j = i,i+1,...,n:
if x[i]<x[j]:
if fi<fj+1:
fi=fj+1
gi=j
gs, , , , .