LDS stores the sequences till each element of arr [ ] Traverse the LDS [ ] [ ] to find the maximum length
for i in range ( N ) : NEW_LINE INDENT x = len ( LDS [ i ] ) NEW_LINE maxLength = max ( maxLength , x ) NEW_LINE DEDENT