Magic Subset
CodeChefOpen on judge ↗
Chef wants to go out to eat Ice-Cream or Candy. He also has n coins of values v0, v1, …, vn-1. The cost of Ice-Cream and Candy are c1 and c2 respectively. He does not like to carry extra money. So he wants to carry a subset of all the coins he has. This subset is a magic subset if it holds the following property: - sum of all the coins in the subset is not more than maximum of c1 and c2. - It i
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