in reply to Re^3: Find Length Of Longest Ascending/Descending Sequence
in thread Find Length Of Longest Ascending/Descending Sequence
The result is 1 more than the length of the longest capture.
Why? If the full string is "123", then the result should be 3. If it's "21234", then the result should be 4. Still need to take overlaps into account even if you just want the length.
Btw, still have the typo in your last bit of code where you use min instead of max.
my $longest = min map length,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Find Length Of Longest Ascending/Descending Sequence
by ikegami (Patriarch) on May 09, 2011 at 23:05 UTC | |
by wind (Priest) on May 09, 2011 at 23:33 UTC |