ATCH-The output that the problem expects does not match with the output that is valid

Problem Link:- CodeChef: Practical coding for everyone

Here as per the question the output for the array =(1,2,1,-10,2,3} should be 9 i.e the sum of the array {1,2,1,2,3} however the output the problem expects is 5 which is sum of {2,3}.

Here the code using DP which did not the get excepted due to the confusion regarding the output:- CodeChef: Practical coding for everyone

Please, clear up my confusion for the question. Thanks in advance.

I don’t really understand how your code works, but:

Here as per the question the output for the array =(1,2,1,-10,2,3} should be 9 i.e the sum of the array {1,2,1,2,3} however the output the problem expects is 5 which is sum of {2,3}.

How do you know that? As in, why should the output be 9? The problem’s description implies it should be 5

Here the code using DP which did not the get excepted due to the confusion regarding the output:- CodeChef: Practical coding for everyone

This will (a) get a runtime error because there’s no way you can declare an array of size n^2 and (b) fail on a case like this:

1  
5  
1 -2 3 -2 3  

Thanks for answering! I realised that I had misinterpreted the question. Happy Coding :slight_smile: