#K64522. Maximum Difference in Consecutive Chapters
Maximum Difference in Consecutive Chapters
Maximum Difference in Consecutive Chapters
In this problem, you are given a book divided into chapters. Each chapter has a certain number of pages. Your task is to determine the maximum difference in the number of pages between any two consecutive chapters.
More formally, for each test case we are given an integer \(N\) representing the number of chapters in the book, followed by \(N\) integers where the \(i^{th}\) integer represents the number of pages in the \(i^{th}\) chapter.
Your task is to compute the maximum value of \(|a_i - a_{i+1}|\) for \(1 \leq i < N\). If there is only one chapter, the answer is defined to be 0.
Input/Output Requirements: The input will be read from standard input (stdin) and the output must be printed to standard output (stdout).
inputFormat
The first line of the input contains a single integer \(T\) representing the number of test cases. Each test case is described by two lines:
- The first line contains an integer \(N\), the number of chapters.
- The second line contains \(N\) space-separated integers, where the \(i^{th}\) integer represents the number of pages in the \(i^{th}\) chapter.
Note: The input should be read from stdin.
outputFormat
For each test case, print a single line containing one integer — the maximum difference between the number of pages in any two consecutive chapters.
Note: The output should be printed to stdout.
## sample1
1
100
0
</p>