← All problemsSign in

Chef and New Year Present

Chef's friend Leo told Chef that he would give him a present on the occasion of New Year. Although Chef was very happy to know that, Leo imposed a condition on which gift to give. There were two choices- either a book on algorithms or a video game. To decide the gift, Leo gave Chef the following problem: A graph is given consisting of $n$ nodes where each node has a value. An array $ar$ is give

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