#K2201. Minimum Number of Traffic Lights
Minimum Number of Traffic Lights
Minimum Number of Traffic Lights
You are given the positions of bus stops along a straight road. In order to ensure safety and regulate traffic, a traffic light must be installed in each segment between two consecutive bus stops. Given that there are n bus stops, there exist \(n-1\) intervals between them, and therefore the minimum number of traffic lights required is \(n-1\).
Note: The positions of the bus stops are provided in increasing order and are not used for any computation since one traffic light per interval is always optimal.
inputFormat
The first line contains an integer \(T\) representing the number of test cases. Each test case consists of two lines:
- The first line contains a single integer \(n\) (the number of bus stops).
- The second line contains \(n\) space-separated integers, the positions of the bus stops in increasing order.
outputFormat
For each test case, output a single integer on a new line representing the minimum number of traffic lights required (which is \(n-1\)).
## sample2
4
0 3 7 12
3
1 5 10
3
2
</p>