DMPG '17 S1 - Molly and Difference
View as PDFMolly loves subtraction. She also loves non-negative numbers. For her birthday, Molly received an array  of integers. To make up for the fact that you forgot to bring her a present, you decide to tell her the minimum value of 
 such that 
, such that 
.
Constraints
For all subtasks:
Subtask 1 [40%]
Subtask 2 [60%]
Input Specification
Line : An integer, 
.
Line : 
 space separated integers, the array 
.
Output Specification
The minimum value of .
Sample Input
5
21 -10 7 3 18
Sample Output
3
Comments
what should i do if i keep getting TLE in Batch #3, using JAVA..... Thanks
Use BufferedReader
Thanks :-)
Hint for Python Coders getting TLE: Use
PyPyinstead.