Hints on CONTEST 7 DP

Hints on LRNDSA07 Dynamic programming.
Count subarray efficient approach, as I am able to solve it in O(n^2)

O(n^2) won’t work. All you have to do is to go through all the elements in your array once and count the lengths of all non-decreasing subarrays (they must be consecutive). This can be done in O(n). Now try this approach and let me know if you’re stuck. I’ll help you proceed after that.

Thanks, It worked, but how this approach is related to DP ?