lps using dp