# LCS related (Largest/Longest Increasing Sequence)

#### For each element in the array or on in the tree, they all carry three fields :

1. &#x20;the maximum increasing / decreasing length ends at the current element,
2. its own value&#x20;
3. the total number of maximum length,\\

Each time when we visit a element, we will use its `2)` to update `1)` and `3)`, the only difference is for `array` we use `iteration` while for `tree` we use `recursion`......

\
Also, for `substring` problem, we usually use only one `for` loop because for each index, we only care about the relationship between its two neighbors, while for `subsequence` problem, we use two `for` loops , because for each index, any other indexes can do something...
