algorithm,erlang,dynamic-programming,combinatorics,lis

Your current implementation of lis/1 function is O(n), I don't see any reasons to doubt. But there is some problem. You implementation doesn't actually calculate valid LIS. Try lis(lists:reverse([1,2,3,4,1,2])) for error example. Longest increasing sequense is [1,2,3,4], right? But your algorith returns 6 as result. First error in your algorithm...

ambg=[] is a list. It can only be indexed with an integer, e.g ambg[i]. ambg[i,j] is the equivalent to ambg[(i,j)], where (i,j) is a tuple. Hence the error message. If ambg was a list of lists, then it could indexed as ambg[i],[j]. But lists of lists are often constructed by...

This problem is trying to find the cheapest way of moving cards to get them into a correct order. Permutation Suppose we have red, green, and blue cards with numbers 1 to 4. All the same colour have to be together, and inside each group, the numbers must be sorted....