You are viewing a single comment's thread. Return to all comments →
Had the same doubt seeing the above comments but no one mentioned why and i couldn't find any logic to that arguement.
It can be
There is nothing wrong with our M-x becoming -ive cause in the original question we are adding values to nos. so they can never be negative.It is just to make our compress our question we are subtracting and getting -ive values and so it won't affect the original problem.
Consider the eg:
1 4 4
if x = 0 M-x = 1
ans = 4
if x = 1 M-x = 0
ans = 4
if x = 2 M-x = -1
ans = 3 ( 1 4 4 1 6 6 6 6 11 11 11 11)
that's lesser than wat we would get for M-x>=0
Plz Correct me if i'm wrong.
I had the same doubt and I think you're right. Considering the 1 4 4 example it should be necessary to take into account a -ve baseline as originally the question was of addition.
I can confirm that you are correct.
for my case if m is min of given list of chocolates, then we gotta check m,m-1,m-2 to find the correct answer.