Black, Michael (IS) <michael.bla...@ngc.com> wrote: > Pseudo-code: > > lastchar=''; > For (char c in array) > if (lastchar = '' || c = lastchar+1) > curseq.push(c); > else > curseq.clear(); > curseq..push(c); > end
The longest increasing subsequence doesn't need to be contiguous. Nor does the difference between two neighboring elements have to be exactly one - it just have to be a positive number. At least as defined at http://en.wikipedia.org/wiki/Longest_increasing_subsequence E.g. for a sequence of (1, 100, 2, 4) your algorithm finds (1), while the correct answer is (1, 2, 4). -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users