We got this problem in our course that no one who I had talked to solved it. I would like for some help. So here's the problem:
Let A be array of length n which contains n digits (digit is between 0-9). A numeral sub-sequence of A is a sequence of positive numbers which their digits compose a sub-sequence of A, when all digits of a certain number in the sequence appear in a row in A.
For example: the sequence 13,1,345,89,23 is a numeral sub-sequence of input array A: [1,3,5,1,2,3,4,5,8,9,4,5,2,3]
Length of a numeral sub-sequence is the amount of numbers which appear in it (in the example above: 5) Numeral sub-sequence is increasing if every number in the sequence is bigger than the number before it.
The request is to find an algorithm in dynamic programming approach (based on recursive formula) that finds the longest increasing numeral sub-sequence of an input array A.
Thanks in advance for all helpers!
A. So, firstly, you remove all the numbers in the sequence13,1,345,89,23, 400which at least one digit not present in arrayA. In this case we will drop400. (Now any sequence will form a numeral sub-sequence). Secondly, you just follow the usual longest increasing subsequence approach on the remaining numbers(13,1,345,89,23) to find the longest increasing numeral subsequence.A. Am I right? And do you need to find the length of the longest sequence or the sequence itself? And will it be valid if I say91is a numeral number toA? Also, is this (31, 1, 543, 98, 32) a valid numeral subsequence to A?