Longest Increasing Sequence

Define li to be the length of the longest sequence ending with si.

$l_i = \max\limits_{0<j<i} \ \ l_j + 1$ when (sj < si)
l0 = 0

(1)