My program finds the length sub-string in that goes in ascending order that does not have to be contiguous.
So if I were to enter: 5;3;4;8;6;7
The output would be: 4
I would like my program to output the largest sub-sequence as well. And to do this, I would need the index of certain parts of the array: 5;3;4;8;6;7
, as illustrated in a question I previously asked: Looking for a hint (not the answer) on how to return the longest acsending non contiguous substring when I already have the length
So if the input was: 5;3;4;8;6;7
Index: 0 1 2 3 4 5
Value: 5 3 4 8 6 7
------------ ----------------
Length: 1 1 2 3 3 4
Predecessor: -1 -1 1 2 2 4
I would need the index of each time the Length value, is one smaller than the previous value.So I would need the index of: 6,,8,4,3 and 5
However I am not sure how to get the indexes of these values in Java. Is there a method that would allow me to do this easily?
虽然不是数组,但我将使用List和indexOf(Object)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.