Chef and Kites
CodeChefOpen on judge ↗
After celebrating Holi, Chef decided to solve a problem. He has N Kites, each has a number written on it. The i-th kite has number A[i] written on it. He wants to tie all the kites, so that when he puts one kite in air, all others are also in air. To tie i-th and j-th kite, it takes effort of min(A[i] % A[j], A[j] % A[i]). Everyone wants to do their work with minimum effort, Chef is no other perso
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.
Sign in to chat with the tutor and save your progress.
Sign in to start