category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

2110. Number of Smooth Descent Periods of a Stock, DP, 1D type

Code ```cpp long long getDescentPeriods(vector& prices) { int n = prices.size(); vector dp(n, 1); for (int i = 1; i < n; i++) { if (prices[i - 1] == prices[i] + 1) { dp[i] += dp[i - 1]; } } long long sum = 0; for (const auto & i: dp) { cout << i << ' '; sum += i; } return sum; ``` </details>