← All problemsSign in

Stable market

CodeChefRating 2151Open on judge ↗

Sometimes, the stability of a stock market is at least as important as rapid price changes. Let a stable block be a maximal consecutive block of days with same stock prices. Moreover, let a stable block of order K be a stable block of length at least K. For example, if stock prices for 7 consecutive days are: 20, 10, 10, 7, 7, 7, 10, then there are 4 stable blocks there: [20], [10, 10], [7, 7,

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start