← All problemsSign in

ALIBABA

Alibaba finds a secret den in the jungle. He exclaims "Khulja SimSim!" and the magical den lets him in. He sees N stacks of gold coins each numbered from 1 to N lined up infront of him. The ith stack contains A[i] number of gold coins. There are M horses standing on one side of the den and a temple of Mahashweta devi on the other side. He has to select a subset amongst the stacks of gold coins in

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