Please help! I am getting WA for my code for practice (easy) problem chef and integers.

Your algorithm is not correct. Here is a test case (there are many) for which your program gives wrong answer.

3

-5 -4 -9

2

Your code gives 16, but the correct answer should be 14 (four times first type operation and once second type operation).

1 Like