Chef and Weights
CodeChefOpen on judge ↗
There are n items having different weights. Chef wants to put each item in a container. A container may have one or two items in it (i.e. container can store 1 or 2 (items)) and additionally $total$ $weight$ in a container may not exceed $X$ (x: maximum weight one container can hold). You are given with an array containing weight of each item. As always chef is busy and wants your help so h
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