Rod costs
CodeChefOpen on judge ↗
Consider a collection of N rods, each associated with a length L. Each rod costs one unit. If Chef buys a rod with length L, then he also gets all rods with lengths in the range [L, L+6], both inclusive. Your task is to find the minimum cost to buy all N rods Input - First line of the input has an integer N - The next line has N space separated integers L, each denoting a rod of length of Outp
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