← All problemsSign in

Global Economy

Consider N countries all over the world. All the countries have their economies represented as per capita income (integer value). Chef is now concerned as many countries have different economies. So he wants all of them to have same economy say X. So he decides to sort all the economies. Now Chef can choose any number of continuous countries (basically a subarray) and add any arbitrary integer

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