Algorithmic puzzle: Continuous Increasing Subsequences

In this blog post, we’ll tackle the following puzzle:

Given an array of integers, count the number of continuous subsequences, such that elements of every subsequence are arranged in strictly increasing order.

The optimal solution to this puzzle is to use the dynamic programming (DP) technique. But, in order to apply this technique, we first need to express the solution through a recurrent formula. So, I will start first by expressing it in Haskell, and then translate the implementation to PHP.

Continue reading “Algorithmic puzzle: Continuous Increasing Subsequences”