Algorithmic Puzzle: Continuous Increasing Subsequences(bor0.wordpress.com)
bor0.wordpress.com
Algorithmic Puzzle: Continuous Increasing Subsequences
https://bor0.wordpress.com/2021/04/09/algorithmic-puzzle-continuous-increasing-subsequences/
1 コメント
It's much simpler, if there's an increasing run of length k, it contains k(k+1)/2 subruns. So you can just do one pass over the array, keeping track of the length of the current run.