7 3 4 9 2 8 4 5 2 1 6 3 10then the length of the longest decreasing subsequence in this sequence is: 5, and in this case there are two such maximal subsequences:
9 8 5 2 1 9 8 4 2 1The input-output description of this problem is:
Input: A sequence S = a1,a2,...,an (you can assume that the sequence is stored in an array) of length n, where each ai is a real number.
Output: Your pseudo-code should print the following output:
Solve this problem following the steps below.
A path from (0,0) to (n,m) is a sequence (0,0)=(a_{0},b_{0}),(a_{1},b_{1}),(a_{2},b_{2}),...,(a_{k},b_{k})=(n,m) satisfying the following constraints:
You can only walk one block to the east (right) or one block to the north (up) at a time, and only on the avenues and on the streets (no diagonal moves allowed). For instance, a possible path to go from (0,0) to (2,3) is: (0,0), (0,1), (1,1), (1,2), (1,3), (2,3). The sequence (0,0), (1,1), (2,2), (2,3) is NOT a valid path, because it "cuts corners", and the sequence (0,0),(2,0),(2,3) is NOT a valid path because it skips intersections. Hence, for every i < k in the path:
Assume that there is exactly one path to go from a grid position to itself. The input-output description of this problem is:
Input: Two integers n and m, with n ≥ 0, m ≥ 0.
Output: The total number of different paths on the grid from (0,0) to (n,m) satisfying the two constraints above.
Solve this problem following the steps below.