c++ | Multiple observations | thats it | pushDown DP
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n#define pii pair<int, int>\n#define F first\n#define S second\n\ntypedef long long int ll;\n\nclass Solution {\npublic:\n    int findMaximumLength(vector<int>& nums) {\n        int n = nums.size();\n        \n        vector<ll> prefix(n+1, 0);\n        for (int j = 1; j <= n; j ++) \n            prefix[j] = prefix[j-1] + nums[j-1];\n        \n        vector<pii> max_after(n+1, {1, 1});\n        \n        for (int i = 1; i <= n; i ++) {\n            max_after[i] = max (max_after[i-1], max_after[i]);\n            \n            int cnt = max_after[i].F;\n            int ind = max_after[i].S;\n            \n            ll last_sum = prefix[i] - prefix[ind-1];\n            \n            int first_valid_ind = lower_bound(prefix.begin(), prefix.end(), prefix[i]+last_sum) - prefix.begin();\n            if (first_valid_ind > n) continue;\n            \n            max_after[first_valid_ind] = max(max_after[first_valid_ind], {cnt+1, i+1});            \n        }\n        \n        return max_after[n].F;\n    }\n};\n```
['C++']