[Solved] What is wrong in this solution to a codejam quiz? [closed]


Your algorithm is wrong for type 2. It just happens that all of the examples happen to have the greatest difference items being between the second last item and the last item, which your code relies on (the test for i==vec.size()-2). This is obviously not the case for all of the full tests.

You will need to think of a different algorithm.

solved What is wrong in this solution to a codejam quiz? [closed]