You need two arrays: = length of LIS ending at = number of LIS of that length ending at When extending from to (where ):
If : found a longer path. Set and .
If : found another path of same length. Add to . Base case: , for all .
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Length and count
You need two arrays: = length of LIS ending at = number of LIS of that length ending at When extending from to (where ):
If : found a longer path. Set and .
If : found another path of same length. Add to . Base case: , for all .