*Dynamic Programming basic example:
A person can create a flower bouquet with either 3 roses (cost of bouquet = p) or 1 rose and 1 lily (cost = q) In an array of flowers, the person has to select contiguous set of flowers i.e. 2 or 3 to gain maximum cost.
Input format: A string of 0(denotes rose) and 1(denotes lily). Output : Maximum cost.
Examples:
Input: p = 2, q = 3, s = 0001000 Output: 5