时间复杂度 $O(n^2)$
空间复杂度 $O(1)$
对暴力破解的优化
dp[i] represents number of satisfied sub-arrays ends with i, so answer will be sum of dp
Last updated 3 years ago