add lis and lps problem solution