← All problemsSign in

How sweet!

Chef decided to give Chefi a pair of donuts from the shop. There are n donuts in the shop and the i-th of them has sweetness number bi. Chefi is a very strange girl so she doesn't want to have the two most sweet donuts necessarily. She wants to have those pairs of donuts that their sweetness difference is maximal possible! Your task is to write a program which calculates two things: 1- The maxim

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