Games on Arrays
CodeChefOpen on judge ↗
Description Chef is interested in playing with arrays. He had a pair of arrays.The size of the arrays are same. Let the first array be m and second array be s. Now he decided to create another array a which is of same size as m and s. Let the index be i. The value of ai must be in between mi and si i.e., mi ≤ ai ≤ si. Chef also wants to minimize the sum $$\sum_{i=2}^n\vert a_i − a_{i-1}\vert$$ C
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