Category: DP

Longest Alternating Subsequence Problem

Longest Alternating Subsequence is a problem of finding a subsequence of a given sequence in which the elements are in alternating order, and in which the sequence is as long as possible.

Maximum Product Rod Cutting

Given a rod of length n, find the optimal way to cut rod into smaller rods in order to maximize product of price of each of the smaller rod. Assume each rod of length i has price i.

Rod Cutting Problem

Given a rod of length n and list of prices of rod of length i where 1 < = i

Minimum Sum Partition problem

Given a set of positive integers S, partition the set S into two subsets S1, S2 such that the difference between the sum of elements in S1 and the sum of elements in S2 is minimized.

Subset sum problem

Given a set of positive integers and an integer s, is there any non-empty subset whose sum to s.

Maximize value of the expression

Given an array A, maximize value of the expression (A[s] – A[r] + A[q] – A[p]) where p, q, r and s are indexes of the input array and s > r > q > p.