Make Array Empty
CodeChefOpen on judge ↗
Keshav has an array of $n$ integers $[a_1,a_2,a_3,.. a_n]$. He can perform the following operation on the given array any number of times. (i) if the leftmost or rightmost element is zero remove this element from the array at cost 0 (ii) he can replace the leftmost element $a_l$ to $D(a_l)$ at the cost of $F(a_l)*a_l$ (iii) he can replace the rightmost element $a_r$ to $D(a_r)$ at the cost o
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