The test case (10, 20 30, 40) yields the expected result 4 just fine when it is the only test case. However, when (10,20,30,40) is one among the ten test cases provided in the question, it gives an incorrect answer of 3.
Please find attached:
- code link to codingblocks ide:
https://ide.codingblocks.com/s/90951 - link to download the ten test cases:
https://cb-s3-bucket-ind-1.s3.amazonaws.com/testCases/cd39ef28-ec20-4d56-9060-6727789c9be5