Chef and stones

Explain if the input is 14 17 5 then how the answer is 3 and not 11.

step 1 - x_{0}=5 , n1=14-5 or 9 n2=17-5 or 12

step 2 - x_{1}=4 , n1=9-4 or 5 n2=12-4 or 8

step 3 - x_{2}=3 , n1=5-3 or 2 n2=8-3 or 5

step 4 - x_{3}=2 , n1=2-2 or 0 n2=5-2 or 3

therefore, n1+n2 = 3 :slight_smile:

thanks buddy, I thought we have to start from 1…m